如何让一个格式化的日期为毫秒? [英] how to get a formatted date as milliseconds?
本文介绍了如何让一个格式化的日期为毫秒?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有sqllite数据库格式的日期,使用这一个图形视图,我需要它在很长的数字格式。
I have a formatted date from sqllite database, to use this in a graph view I need to format it in a long number.
的格式为:
2012-07-11 10点55分21秒
2012-07-11 10:55:21
我怎么能转换成毫秒?
推荐答案
您可以使用此code字符串转换Date对象: -
You can convert the string into a Date object using this code:-
日期D = DateFormat.parse(String s)将
然后把它转换成毫秒,通过使用内置的方法
And then convert it into milliseconds by using the inbuilt method
长毫秒= d.getTime();
这篇关于如何让一个格式化的日期为毫秒?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文