formatting date for different locales


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers formatting date for different locales
# 1  
Old 08-22-2007
Question formatting date for different locales

Hi,

I need to know
1.the usage of LC_TIME with setlocale().
2.the usage of getdate() utility

I read that date formatting for different languages needs
1.user-supplied template file and
2.DATEMSK environment variable set to path of the template fie.

Can anyone pls tell me how to do this ?
# 2  
Old 08-22-2007
First off, the format strings are the same regardless of NLS (locale) settings.
ie. %Y is a four digit number %A = day of week. This works unless you are using wide characters- ie, a charset like Greek or Arabic. Then you use alternates. These begin with %E or %O.

Next.
What locale for LC_TIME? And to answer that we need to know which UNIX you're using.
Plus, you do know LC_TIME can affect things like the first day of the week as well.

Do you know about setlocale()?

Finally.
Read the man page about strptime(). It is far easier to use than getdate(), because it does not require an external file.

If you give us exact specifications it would help a lot.
# 3  
Old 08-23-2007
Question date conversions at runtime

Quote:
Originally Posted by jim mcnamara
What locale for LC_TIME? And to answer that we need to know which UNIX you're using.
Plus, you do know LC_TIME can affect things like the first day of the week as well.

Do you know about setlocale()?

If you give us exact specifications it would help a lot.
I need to do date conversions between german and french at runtime.

mine is red hat linux 9
am a beginner & I ve a little knowledge about setlocale and LC_TIME.
I tried a sample helloworld L10N program through gettext utility.

Thanks for the quick reply jim,

Aeon.
 
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

UNIX Date Formatting

Hi I have a shell variable storing DATE in YYYY-MM-DD format is there a way i extract required field say only DD Also, would be great if there is a way which could take date format as well so that code is generic for any date format eg DDMMYYYY or DD/MM/YYYY or YYYY/MM/DD etc. Thanks (4 Replies)
Discussion started by: skyineyes
4 Replies

2. UNIX for Dummies Questions & Answers

Need Date Formatting help

Hi, How can i store the date + time from the output of the ls command in loop in a variable date1? -rw-rw---- 1 user1 admin 500002 Jan 2 21:24 P002607.cssI then want to convert Jan 2 21:24 to this date format 2014-01-02 21:24:00 and save it in date2 variable. Then i would like to add... (1 Reply)
Discussion started by: mohtashims
1 Replies

3. Shell Programming and Scripting

Date formatting in AIX

Can you help in formating the date command in aix to get the following format Oct 11 21:52 Fri Oct 11 21:52:01 PDT 2013 Required output: Oct 11 21:52 Fri Oct 11 21:52:01 PDT 2013 (1 Reply)
Discussion started by: chandu123
1 Replies

4. Shell Programming and Scripting

Formatting date

Hi all Y=`date +'%Y'` M=`date +'%m'` D=`date +'%d'` if && ;then yesterday=$Y$M`expr $D + 30` echo $yesterday else if && ; then yesterday=$Y$M`expr $D + 29` echo $yesterday else if ; then yesterday=$Y$M`expr $D + 27` echo $yesterday else yesterday=$Y$M`expr $D - 1` echo... (8 Replies)
Discussion started by: ultimatix
8 Replies

5. Shell Programming and Scripting

Formatting a date

Hi, the date value retrieved by a parameter from the table is of the format dd/mm/yyyy. please let me know how to convert this to YYYYMMDD using sed thanks (4 Replies)
Discussion started by: swasid
4 Replies

6. OS X (Apple)

Date Formatting, etc.

Hi - I'm using GeekTool to customize my desktop in OS X 10.5.8 I'm a complete novice as far as UNIX commands, just know enough to be dangerous. I have a command entered as a Shell to display my events from iCal: This makes my events show something like this: While this is... (1 Reply)
Discussion started by: patricksprague
1 Replies

7. Shell Programming and Scripting

date formatting

Hi i need to have the date in the format like dd-mon-yyyy my script goes like this #!/usr/bin/bash for f in /space/can /home/lbs/current/externalcdrbackup/L_CDR_Configuration/1/200903122* ; do awk '{sum++;}END{for(i in sum) {print d,h,m,i, sum}}' "d=$(date +'%m-%d-%Y')" "h=$(date +'%H')"... (8 Replies)
Discussion started by: aemunathan
8 Replies

8. UNIX for Dummies Questions & Answers

Date formatting

Running bash how do I input the date in the command line like 3/20/90 and get an output formmated like March, 20 1990. (8 Replies)
Discussion started by: knc9233
8 Replies

9. Shell Programming and Scripting

date formatting

Date format MM/DD/YYYY required is YYYYMMDD, I tried using sed but could not get it any help please. (4 Replies)
Discussion started by: mgirinath
4 Replies

10. Shell Programming and Scripting

Formatting date

i need date in the following format December 14, 2005. With date +"%b %d, %Y" command i am getting the following output :- Dec 14, 2005. can anyone pls tell me how to get the full month name (2 Replies)
Discussion started by: radhika03
2 Replies
Login or Register to Ask a Question