Page 1 of 1
Is this a (date) bug or what I just got wrong?
Posted: Thu Mar 08, 2012 9:17 am
by dexter
Code: Select all
> (date-parse "27/Feb/2012:17:14:34" "%d/%b/%Y:%H:%M:%S")
1330362874
> (date 1330362874 0 "%d/%b/%Y:%H:%M:%S")
"28/Feb/2012:01:14:34"
parsed time not equal .
Why??
I did not change locale, I created this time "27/Feb/2012:17:14:34" under the same locale.
Code: Select all
~ $ newlisp
newLISP v.10.4.0 64-bit on OSX IPv4/6, execute 'newlisp -h' for more info.
Re: Is this a (date) bug or what I just got wrong?
Posted: Thu Mar 08, 2012 12:27 pm
by johu
According to
newLISP manual,
date-parse returns the number of UTC seconds passed since January 1st, 1970 UTC starting with 0.
and
date returns returns the local time zone's current date and time as a string representation.
Then,
Code: Select all
> (date-list 1330362874)
(2012 2 27 17 14 34 57 1)
Next,
Time zone offset in minutes is obtained by (now 0 -2)
Therefore, since v.10.4.0
Code: Select all
(date 1330362874 (- (now 0 -2)) "%d/%b/%Y:%H:%M:%S")
before v.10.4.0
Code: Select all
(date 1330362874 (now 0 -2) "%d/%b/%Y:%H:%M:%S")
You will get the wanted date string, maybe.