View previous topic :: View next topic |
Author |
Message |
friesia Apprentice
Joined: 23 Mar 2007 Posts: 202
|
Posted: Fri Apr 05, 2013 11:06 am Post subject: Locale with ISO 8601 (RFC 3339) date/time format |
|
|
Is there any system locale with date/time format set to ISO 8601 standard?
I'd like to set LC_TIME variable to that locale. |
|
Back to top |
|
|
khayyam Watchman
Joined: 07 Jun 2012 Posts: 6227 Location: Room 101
|
Posted: Fri Apr 05, 2013 10:42 pm Post subject: |
|
|
friesia ...
I think we discussed this on irc ... anyhow, I probably wasn't as clear as I could be, basically it isn't the locale as such but the d_fmt, date_fmt, etc, supplied by that locale, and iso-8601 isn't a locale but an output method for strftime.
Code: | # LC_TIME="en_GB.UTF-8" locale -k LC_TIME
abday="Sun;Mon;Tue;Wed;Thu;Fri;Sat"
day="Sunday;Monday;Tuesday;Wednesday;Thursday;Friday;Saturday"
abmon="Jan;Feb;Mar;Apr;May;Jun;Jul;Aug;Sep;Oct;Nov;Dec"
mon="January;February;March;April;May;June;July;August;September;October;November;December"
am_pm=";"
d_t_fmt="%a %d %b %Y %T %Z"
d_fmt="%d/%m/%y"
t_fmt="%T"
t_fmt_ampm=""
era=
era_year=""
era_d_fmt=""
alt_digits=
era_d_t_fmt=""
era_t_fmt=""
time-era-num-entries=0
time-era-entries="S"
week-ndays=7
week-1stday=19971130
week-1stweek=4
first_weekday=2
first_workday=2
cal_direction=1
timezone=""
date_fmt="%a %b %e %H:%M:%S %Z %Y"
time-codeset="UTF-8" |
We can see from the above that the date_fmt is "%a %b %e %H:%M:%S %Z %Y", as we can see from the following:
Code: | # LC_TIME="en_GB.UTF-8" date
Fri Apr 5 23:51:24 CEST 2013
# LC_TIME="en_GB.UTF-8" date --iso-8601
2013-04-05
# LC_TIME="en_GB.UTF-8" date "+%F %H:%M:%S"
2013-04-05 23:51:29
# TIME_STYLE="iso-long" date
Fri Apr 5 23:51:36 CEST 2013
# TIME_STYLE="locale" ls -l
total 8
-rw------- 1 khayyam users 2 Mar 28 03:51 foo.txt
-rw------- 1 khayyam users 2 Mar 28 03:51 bar.txt
drwx------ 4 khayyam users 92 Apr 3 06:22 baz
# TIME_STYLE="iso-long" ls -l
total 8
-rw------- 1 khayyam users 2 2013-03-28 03:51 foo.txt
-rw------- 1 khayyam users 2 2013-03-28 03:51 bar.txt
drwx------ 4 khayyam users 92 2013-04-03 06:22 baz |
We can see from the above that the date output is modified by strftime.
The en_DK locale uses d_fmt and t_fmt of iso-8601 but this won't effect the output of commands (like 'ls' and 'date') using a specific strftime, or using the date_fmt provided with that locale.
Code: | # LC_TIME="en_DK.UTF-8" locale -k LC_TIME
abday="Sun;Mon;Tue;Wed;Thu;Fri;Sat"
day="Sunday;Monday;Tuesday;Wednesday;Thursday;Friday;Saturday"
abmon="Jan;Feb;Mar;Apr;May;Jun;Jul;Aug;Sep;Oct;Nov;Dec"
mon="January;February;March;April;May;June;July;August;September;October;November;December"
am_pm=";"
d_t_fmt="%Y-%m-%dT%T %Z"
d_fmt="%Y-%m-%d"
t_fmt="%T"
t_fmt_ampm=""
era=
era_year=""
era_d_fmt=""
alt_digits=
era_d_t_fmt=""
era_t_fmt=""
time-era-num-entries=0
time-era-entries="S"
week-ndays=7
week-1stday=19971130
week-1stweek=4
first_weekday=2
first_workday=2
cal_direction=1
timezone=""
date_fmt="%a %b %e %H:%M:%S %Z %Y"
time-codeset="UTF-8"
# LC_TIME="en_DK.UTF-8" date
Sat Apr 6 23:52:20 CEST 2013 |
So, I'm not sure how this can be achived other than changing the date_fmt set in the specific locale, as I don't think there is a locale who's d_fmt, t_fmt, and date_fmt, are entirely iso-8601. Also, I'm not enirely sure what commands will respect this and provide iso-8601 strftime without other variables being set.
Your may have to do something like this.
HTH & best ... khay |
|
Back to top |
|
|
friesia Apprentice
Joined: 23 Mar 2007 Posts: 202
|
Posted: Sat Apr 06, 2013 4:17 pm Post subject: |
|
|
Ok, I guess i"ll use ja_JP instead of making a custom file, it has big-endian representation at least |
|
Back to top |
|
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|