【发布时间】:2012-04-23 02:59:15
【问题描述】:
我得到日期字符串--“2012-04-19 20:51:06”。然后我通过 SimpleDateFormat 得到毫秒时间。
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd hh:mm:ss");
Date d=sdf.parse("2012-04-19 20:51:06");
long milliTime=d.getTime()
那么milliTime就是1334839866000L
但是,当我将 milliTime 转换为日期格式字符串时。结果是“2012-04-19 08:51:06”
long time = 1334839866000L;
Date date = new Date(time);
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd hh:mm:ss");
String t = sdf.format(date);
有什么问题?
【问题讨论】:
标签: java date simpledateformat