Joda time, Period to total millis

后端 未结 3 926
遇见更好的自我
遇见更好的自我 2021-02-18 15:00

I\'m trying to get the total amount of Milliseconds (not the millis field) from the Period object instance. I\'ve tried multiple conversions, as I couldn\'t fi

3条回答
  •  终归单人心
    2021-02-18 15:44

    If you want to get the millis from a specific time it can be done by using the plus() or minus() methods of the DateTime class.

    e.g. getting the millis from now

     DateTime start = new DateTime();  //NOW
     DateTime end = start.plus();
     long millis = end.getMillis() - start.getMillis();
    

提交回复
热议问题