I am a J2ME developer I am new to Dani Web.
I am using chartapi.finance.yahoo.com to calculate and display chart.
My questions is how to convert TIMESTAMP value to a Java Date or Calendar Object ?.....
> My questions is how to convert TIMESTAMP value to a Java Date
> or Calendar Object ?.....
It seems that the Timestamp here refers to the Unix timestamp (which is the number of seconds elapsed since January 1, 1970 (midnight UTC/GMT). This is in contrast with the way Java timestamp works which is considered to be the number of milliseconds elapsed since January 1, 1970 (midnight UTC/GMT). Multiplying the returned value with 1000 should do the trick here.
Also, ensure that you don't fall in the trap of truncation while multiplying those values.
Date d = new Date(1265207400 * 1000); //is different from
Date d = new Date(1265207400 * 1000L); // or
Date d = new Date(1265207400000);
In case you are still wondering why, in the first declaration the integer result of 1265207400 * 1000 which is 1966688416 and not 1265207400000 , is passed to the Date constructor leading to erroneous results.