PDA

View Full Version : [CLOSED]Date constructor drops off seconds?



jtpacheco
18 Oct 2010, 5:57 AM
EDIT: Disregard, turns out the time in ms was malformed due to a date parsing issue on my servlet.

So I've got a long representing the date/time passed back from my server, and I want to pass it through an Ext Date object, in the format of
'm/d/Y H:i:s T' (which gives 10/18/2010 09:48:00 EDT). This is how I'm doing it
var date = new Date(ms_long_from_server);
log.write(date.format('m/d/Y H:i:s T'));The issue is that the seconds area is always 00, no matter what time is passed in. The only way I've seen it different is if I print
log.write(new Date().format('m/d/Y H:i:s T'));which correctly prints the seconds as something other than 00.

For whatever reason, does passing in a long representing current time in ms cause the Date object to drop off the seconds? Furthermore, is it perhaps an int -> long issue where the seconds area of the long is simply getting truncated?

Thanks in advance for any help.