IBM Support

Understanding the AIX date command format 

Question & Answer


Question

Why are there different formats for the 'date' command in different locales?

For example,

en_US.UTF-8: May 27, 2020 at 01:22:56 PM CDT

EN_US.UTF-8: Wed May 27 13:22:56 CDT 2020

en_US.ISO8859-1: Wed May 27 13:22:56 CDT 2020

C: Wed May 27 13:22:56 CDT 2020
 

Answer

The date command uses strftime to format the date format based on locale data. For the C (POSIX) locale, the format is hardcoded:  
format = "%a %b %e %H:%M:%S %Z %Y"
Wed May 27 13:22:56 CDT 2020
The following specifications are listed in the strftime documentation: https://www.ibm.com/support/knowledgecenter/ssw_aix_72/s_bostechref/strftime.html
%a: The abbreviated weekday name. 
%b: The abbreviated month name. 
%c: The day of the month as a decimal number [1,31]; a single digit is preceded by a space.
%H: The hour (24-hour clock) as a decimal number [00,23]. 
%M: The minute as a decimal number [00,59]. 
%S:  The second as a decimal number [00,60]. 
%Y: The year as a decimal number (for example, 1997). 
You can view the locale's data by examining the LC_TIME values.
# locale -ck LC_TIME | grep d_t_fmt | grep -v era
Here are some examples of AIX UTF-8 locale date formats:
CS_CZ.UTF-8
d_t_fmt="%a %e %b %Y %H:%M:%S"
St 27 kvě 2020 11:32:54
cs_CZ.UTF-8
d_t_fmt="%e. %B %Y %H:%M:%S %Z"
27. května 2020 11:32:55 CDT
DE_DE.UTF-8
d_t_fmt="%a %e %b %H:%M:%S %Y"
Mi 27 Mai 11:32:54 2020
de_DE.UTF-8
d_t_fmt="%e. %B %Y %H:%M:%S %Z"
27. Mai 2020 11:32:55 CDT
EN_GB.UTF-8
d_t_fmt="%a %e %b %H:%M:%S %Y"
Wed 27 May 11:32:54 2020
en_GB.UTF-8
d_t_fmt="%e %B %Y %H:%M:%S %Z"
27 May 2020 11:32:55 CDT
EN_US.UTF-8
d_t_fmt="%a %b %e %H:%M:%S %Z %Y"
Wed May 27 11:32:55 CDT 2020
en_US.UTF-8
d_t_fmt="%B %e, %Y at %I:%M:%S %p %Z"
May 27, 2020 at 11:32:55 AM CDT
ES_ES.UTF-8
d_t_fmt="%a %e %b %H:%M:%S %Y"
mié 27 may 11:32:55 2020
es_ES.UTF-8
d_t_fmt="%e de %B de %Y, %H:%M:%S %Z"
27 de mayo de 2020, 11:32:55 CDT
FR_FR.UTF-8
d_t_fmt="%a %e %b %H:%M:%S %Z %Y"
mer 27 mai 11:32:55 CDT 2020
fr_FR.UTF-8
d_t_fmt="%e %B %Y %H:%M:%S %Z"
27 mai 2020 11:32:55 CDT
JA_JP.UTF-8
d_t_fmt="%a %b %e %H:%M:%S %Z %Y"
Wed May 27 11:32:55 CDT 2020
ja_JP.UTF-8
d_t_fmt="%Y年%m月%e日 %H:%M:%S %Z"
2020年05月27日 11:32:55 CDT
KO_KR.UTF-8
d_t_fmt="%Y년 %B %e일 %A %H시 %M분 %S초"
2020년 5월 27일 수요일 11시 32분 55초
PT_BR.UTF-8
d_t_fmt="%a %e %b %Y %H:%M:%S"
Qua 27 Mai 2020 11:32:55
pt_BR.UTF-8
d_t_fmt="%e de %B de %Y %H:%M:%S %Z"
27 de maio de 2020 11:32:55 CDT
SV_SE.UTF-8
d_t_fmt="%a %b %e %H.%M.%S %Y"
ons maj 27 11.32.55 2020
sv_SE.UTF-8
d_t_fmt="%e %B %Y %H:%M:%S %Z"
27 maj 2020 11:32:55 CDT
TH_TH.UTF-8
d_t_fmt="%a %e %b %o %X"
 พ 27 พ.ค.  2563 11:32:55
 
th_TH.UTF-8
d_t_fmt="%e %B %Y %H นาฬิกา %M นาที %S วินาที %Z"
27 พฤษภาคม 2020 11 นาฬิกา 32 นาที 55 วินาที CDT
ZH_CN.UTF-8
d_t_fmt="%EY%m月%d日  %A  %H时%M分%S秒"
公元2020年05月27日  星期三  11时32分55秒
Here are some Latin-1 locale date formats:
de_DE.ISO8859-1
d_t_fmt="%a %e %b %H:%M:%S %Y"
Mi 27 Mai 11:38:35 2020
en_GB.ISO8859-1
d_t_fmt="%a %e %b %H:%M:%S %Y"
Wed 27 May 11:38:35 2020
en_US.ISO8859-1
d_t_fmt="%a %b %e %H:%M:%S %Z %Y"
Wed May 27 11:38:35 CDT 2020
fi_FI.ISO8859-1
d_t_fmt="%e. %Bta %Y klo %H.%M.%S"
27. toukokuuta 2020 klo 11.38.35
fr_FR.ISO8859-1
d_t_fmt="%a %e %b %H:%M:%S %Z %Y"
mer 27 mai 11:38:35 CDT 2020
it_IT.ISO8859-1
d_t_fmt="%a %e %b %H.%M.%S %Y"
mer 27 mag 11.38.35 2020
nl_NL.ISO8859-1
d_t_fmt="%a %b %e %H:%M:%S %Y"
wo mei 27 11:38:35 2020
pt_BR.ISO8859-1
d_t_fmt="%a %e %b %Y %H:%M:%S"
Qua 27 Mai 2020 11:38:35
pt_PT.ISO8859-1
d_t_fmt="%a %e %b %H:%M:%S %Y"
Qua 27 Mai 11:38:35 2020

 

 
SUPPORT

If you require more assistance, use the following step-by-step instructions to contact IBM to open a case for software with an active and valid support contract.  

1. Document (or collect screen captures of) all symptoms, errors, and messages related to your issue.

2. Capture any logs or data relevant to the situation.

3. Contact IBM to open a case:

   -For electronic support, see the IBM Support Community:
     https://www.ibm.com/mysupport
   -If you require telephone support, see the web page:
      https://www.ibm.com/planetwide/

4. Provide a clear, concise description of the issue.

5. If the system is accessible, collect a system snap, and upload all of the details and data for your case.

 - For guidance, see: Working with IBM AIX Support: Collecting snap data

[{"Business Unit":{"code":"BU058","label":"IBM Infrastructure w\/TPS"},"Product":{"code":"SWG10","label":"AIX"},"ARM Category":[{"code":"a8m50000000L0Q6AAK","label":"Commands->Base system libraries"},{"code":"a8m0z000000cw2lAAA","label":"Desktop->Globalization"}],"ARM Case Number":"TS003751422","Platform":[{"code":"PF025","label":"Platform Independent"}],"Version":"All Version(s)","Line of Business":{"code":"LOB08","label":"Cognitive Systems"}}]

Document Information

Modified date:
27 May 2020

UID

ibm16217399