Is this a (date) bug or what I just got wrong?

Started by dexter, March 08, 2012, 01:17:39 AM

Previous topic - Next topic

dexter


> (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.







~ $ newlisp
newLISP v.10.4.0 64-bit on OSX IPv4/6, execute 'newlisp -h' for more info.

johu

#1
According to http://www.newlisp.org/downloads/manual_frame.html">newLISP manual,
Quote
date-parse returns the number of UTC seconds passed since January 1st, 1970 UTC starting with 0.

and
Quote
date returns returns the local time zone's current date and time as a string representation.

Then,

> (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

(date 1330362874 (- (now 0 -2)) "%d/%b/%Y:%H:%M:%S")

before v.10.4.0

(date 1330362874 (now 0 -2) "%d/%b/%Y:%H:%M:%S")

You will get the wanted date string, maybe.