Home > OS >  How make correctly time with DateFormat
How make correctly time with DateFormat

Time:09-24

I ran into a problem. I made a chat where the time of sending the message is shown, but the time that is shown does not coincide with the current time. I live in Kazakhstan. The screenshot shows the difference.

enter image description here

This is code

DateFormat.yMd().format(message.createdAt)   " "   DateFormat.Hm().format(message.createdAt)

Also, data are taken from firebase.

enter image description here

CodePudding user response:

Check out the LINK

or Write below code for testing what you want see on output:

print(DateFormat.yMMMd().format(DateTime.now()));

CodePudding user response:

Is the Android emulator/device timezone the same as your machines timezone?

Try checking in the Android emulator/device.

I believe it's under System > Date & Time > Time zone

  • Related