[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
DATE command
From: |
Robert |
Subject: |
DATE command |
Date: |
Mon, 15 Feb 2010 13:52:25 -0600 |
User-agent: |
Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.1.4) Gecko/20091113 SeaMonkey/2.0 |
From time to time, I run into a situation where I'd like to know the
elapsed time between events. In theory, this is easily accomplished by
converting the date/time of both events to seconds since the epoch, then
performing several divisions by the appropriate factors.
That is, until you run into this kind of weirdness in which "date" groks
"CST", "EDT" and "EST" but throws up its hands at the thought of Central
Daylight Time.
address@hidden ~]$ date -d "Dec 21 2004 7:42 AM CDT" +%s
date: invalid date `Dec 21 2004 7:42 AM CDT'
address@hidden ~]$ date -d "Dec 21 2004 7:42 AM CST" +%s
1103636520
address@hidden ~]$ date -d "Dec 21 2004 8:42 AM EDT" +%s
1103632920
address@hidden ~]$ date -d "Dec 21 2004 8:42 AM EST" +%s
1103636520
address@hidden ~]$
This is on a CentOS 5.4 machine, fully updated.
address@hidden ~]$ rpm -q coreutils
coreutils-5.97-23.el5_4.1.i386
My apologies if this has already been fixed upstream.