android-date

how to convert milliseconds to date format in android?

六眼飞鱼酱① 提交于 2019-11-26 02:55:29
问题 I have milliseconds. I need it to be converted to date format of example: 23/10/2011 How to achieve it? 回答1: Just Try this Sample code:- import java.text.DateFormat; import java.text.SimpleDateFormat; import java.util.Calendar; public class Test { /** * Main Method */ public static void main(String[] args) { System.out.println(getDate(82233213123L, "dd/MM/yyyy hh:mm:ss.SSS")); } /** * Return date in specified format. * @param milliSeconds Date in milliseconds * @param dateFormat Date format *