simpledateformat to currenttimemillis-like format
Is there a way to bring back a date formatted with SimpleDateFormat to its long equivalent (like开发者_高级运维 System.currentTimeMillis())?
DateFormat format = new SimpleDateFormat("yyyy-MM-dd");
Date date = format.parse(VALUE).getTime();
Simplest way I can think of.
You could use SimpleDateFormat.parse()
to get a Date
object, and then call getTime()
on that Date
object.
That'll give you the number of milliseconds since January 1, 1970, 00:00:00 UTC (same as System.currentTimeMillis()
).
精彩评论