bug-coreutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: date bug


From: Philip Rowlands
Subject: Re: date bug
Date: Tue, 3 Jan 2006 00:45:21 +0000 (GMT)

On Mon, 2 Jan 2006, William Johnson wrote:

I have run this script on my linux router and in cygwin.
In both cases, the date is changed from 2006 to 2005.

<--->
set Time_Stamp="01-Jan-2006 21:22:23"
echo "    $Time_Stamp"

set MyDate=`date --date="$Time_Stamp" "+%G-%m-%d %T %a"`
echo "    $MyDate"
<--->

The problem disappears on January 2.

%G is the confusing expansion here:
       %G     the 4-digit year corresponding to the %V week number

Your example again with a %V included:

$ date --date="01-Jan-2006 21:22:23" "+%G-%m-%d %T %a, week %V"
2005-01-01 21:22:23 Sun, week 52

shows that Sunday 1st Jan 2006 is considered to be part of week 52 of 2005. I confess that I can't think of any situation where "%G-%m-%d" would be a useful expansion, and would suggest using "%Y-%m-%d" instead.


Cheers,
Phil




reply via email to

[Prev in Thread] Current Thread [Next in Thread]