How to format date and time in Android?

前端 未结 24 1292
面向向阳花
面向向阳花 2020-11-22 00:51

How to format correctly according to the device configuration date and time when having a year, month, day, hour and minute?

24条回答
  •  情深已故
    2020-11-22 01:12

    Use build in Time class!

    Time time = new Time();
    time.set(0, 0, 17, 4, 5, 1999);
    Log.i("DateTime", time.format("%d.%m.%Y %H:%M:%S"));
    

提交回复
热议问题