bug-coreutils
[Top][All Lists]
Advanced

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

Linux Date Command gives wrong year with +%g


From: Gary Warner
Subject: Linux Date Command gives wrong year with +%g
Date: Fri, 1 Jan 2010 09:09:14 -0600 (CST)

I'm having an issue with the spam data mine that seems to be related to the 
linux "date" command.

This morning's spam is being labeled as being from 2009.  I immediately assumed 
that someone had hardcoded a year, and started examining code to see who I 
should scold about this.  But in each case, the program is naming the files 
based on a date calculation.  

I'm creating a variable called "NOWDATE" using the command:

NOWDATE=`date +%g%b%d`

Yesterday for example, this resulted in dates of 09Dec31

per the man pages . . . 

%g = last two digits of year of ISO week number
%b = local abbreviated month name (e.g., Jan)
%d = day of month (e.g, 01)

When I give the command, "date", I get:

Fri Jan  1 09:05:06 CST 2010

But when I give the command "date +%g%b%d" I get:

09Jan01

when I give the command "date +%G" I get:

2009

when I give the command "date +%F" I get:
2010-01-01




--

----------------------------------------------------------

Gary Warner
Director of Research in Computer Forensics
The University of Alabama at Birmingham
Department of Computer & Information Sciences
& Department of Justice Sciences
205.934.8620             205.422.2113
address@hidden        address@hidden

-----------------------------------------------------------




reply via email to

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