delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2011/09/01/14:41:43

X-Recipient: archive-cygwin AT delorie DOT com
X-Spam-Check-By: sourceware.org
Date: Thu, 1 Sep 2011 20:40:56 +0200
From: Corinna Vinschen <corinna-cygwin AT cygwin DOT com>
To: cygwin AT cygwin DOT com
Subject: Re: Request locale for ISO 8601 date.
Message-ID: <20110901184056.GB22172@calimero.vinschen.de>
Reply-To: cygwin AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
References: <j3oeps$gcv$1 AT dough DOT gmane DOT org>
MIME-Version: 1.0
In-Reply-To: <j3oeps$gcv$1@dough.gmane.org>
User-Agent: Mutt/1.5.21 (2010-09-15)
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Unsubscribe: <mailto:cygwin-unsubscribe-archive-cygwin=delorie DOT com AT cygwin DOT com>
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com

On Sep  1 20:18, Oleksandr Gavenko wrote:
>  $ for l in `locale -a`; do echo $l `LC_TIME=$l date`; done | tee .dat
>  $ grep -E '[[:digit:]]+-[[:digit:]]+-[[:digit:]]+
> +[[:digit:]]+:[[:digit:]]+:[[:digit:]]+' <.dat
> sq_AL 2011-09-01 8:14:09.MD
> sq_AL.utf8 2011-09-01 8:14:09.MD
> 
> but this is not ISO 8601 as '.MD' component present...
> 
> Usually 'LC_TIME' set to 'en_DK' to get ISO 8601 time format
> but Cygwin miss this locale.

Cygwin provides all locales supported by the underlying Windows system.
Windows doesn't know en_DK.

Linux (better: glibc) supports en_DK, but what you say doesn't work for
me on Linux either:

  $ LC_TIME=en_DK date
  Thu Sep  1 20:30:01 CEST 2011

No ISO 8601 representation.

> It is possible install locale to get ISO 8601 date formatting?

There is no such locale.  I tried your above grep on the Linux locales
(on F15, glibc 2.14), too, and there isn't even one which has ISO 8601
date/time by default.

If you want that date format, you have to enforce it on a per-command
base, for instance:

  $ date +'%F %T'
  $ ls -l --time-style=long-iso
  $ ls -l --time-style='+%F %T'


Corinna

-- 
Corinna Vinschen                  Please, send mails regarding Cygwin to
Cygwin Project Co-Leader          cygwin AT cygwin DOT com
Red Hat

--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019