how to get a formatted date as milliseconds?

前端 未结 3 1003
野趣味
野趣味 2020-12-18 00:44

I have a formatted date from sqllite database, to use this in a graph view I need to format it in a long number.

The format is:

2012-07-11 10:55:21

h

3条回答
  •  小蘑菇
    小蘑菇 (楼主)
    2020-12-18 01:08

    You can convert the string into a Date object using this code:-

    Date d = DateFormat.parse(String s)

    And then convert it into milliseconds by using the inbuilt method

    long millisec = d.getTime();

提交回复
热议问题