LC_TIME=C.ISO8601

My workstations and notebooks normally are in English which is not my native language. For currency etc. I have set it to de_DE. However the date I want in ISO8601 24h format. However this is not supported by default. Here is how to get it:

First you need to install the glibc locale source package.

  • Fedora/RHEL: dnf install glibc-locale-source
  • SUSE: zypper install glibc-i18ndata

Now we need to create a complete new locale, even we just use the LC_TIME part. You do this the following way:

sed -e 's/^title .*/title      "C ISO8601 locale"/' \
   -e 's/^d_t_fmt .*/d_t_fmt "%a %d %b %Y %T %Z"/' \
   -e 's/^d_fmt .*/d_fmt   "%Y-%m-%d"/' \
   -e 's/^t_fmt .*/t_fmt   "%T"/' \
   -e 's/^t_fmt_ampm .*/t_fmt_ampm   ""/' \
   /usr/share/i18n/locales/C > /usr/share/i18n/locales/C.ISO8601
localedef --charmap=UTF-8 --inputfile=C.ISO8601 /usr/lib/locale/C.ISO8601.utf8/

export LC_TIME=C.ISO8601.UTF-8




You may also like...

Leave a Reply

Your email address will not be published. Required fields are marked *