日期格式 1121385600000
?(/* AAPL historical OHLC data from the Google Finance API */
[
/* Jul 2005 */
[1121385600000,41.55],
[1121644800000,41.49],
[1121731200000,43.19],
[1121817600000,43.63],
[1121904000000,43.29],
[1121990400000,44.00],
[1122249600000,43.81],
[1122336000000,43.63],
[1122422400000,43.99],
[1122508800000,43.80],
[1122595200000,42.65],
这段数据在一个网页内的折线图中显示为:
2005-07-15 41.55
07-18 41.49
07-19 43.19
。。。
貌似1121385600000是代表日期的,可是不知道怎么转换的!
高手帮小弟看看
[解决办法]
如些转换
Calendar c = Calendar.getInstance(); long l = 1121385600000l; c.setTimeInMillis(l); System.out.println(c.getTime());
[解决办法]
import java.text.SimpleDateFormat;import java.util.Calendar;public class Test11 { /** * @param args */ public static void main(String[] args) { Calendar c = Calendar.getInstance(); long l = 1121385600000l; c.setTimeInMillis(l); SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd") ; System.out.println("格式化日期 :" + sdf.format(c.getTime())) ; System.out.println("日期:" + c.getTime().toLocaleString()); }}