utc time in kotlin multiplatform giving wrong value

505 views Asked by At

How to get current utc time in kmm ? I tried below code but it gives time 01/01/1970 and it return 0 value.

DateTime.now().utc.milliseconds
1

There are 1 answers

1
shaktiman_droid On

If you're using kotlinx-datetime then simply doing Clock.System.now() would provide time in UTC.

Not sure what DateTime object you're using in your question!