How to get current local date and time in Kotlin

前端 未结 9 1934
半阙折子戏
半阙折子戏 2021-01-31 13:24

How to get current Date (day month and year) and time (hour, minutes and seconds) all in local time in Kotlin?

I tried through LocalDateTime.now() but it is

9条回答
  •  盖世英雄少女心
    2021-01-31 13:56

    java.util.Calendar.getInstance() represents the current time using the current locale and timezone.

    You could also choose to import and use Joda-Time or one of the forks for Android.

提交回复
热议问题