Back

Date Time attribute setting in appwrite console saves as UTC but should save as local

  • 0
  • Databases
  • Web
gaurav_ch
2 Oct, 2023, 08:31

I have a date time field and when I use console to save the data it is saved as local time because of using HTML input type date. But when we retrieve the data, we get it in ISO format with timezone: "2023-10-03T13:49:14.723+00:00" which is UTC by default. How to handle this?

TL;DR
User is experiencing an issue where the date time attribute setting in the appwrite console saves as UTC instead of the local timezone. They would like to know how to handle this. Solution: It is recommended to send and retrieve datetime attributes as UTC and then show them as local time. The console currently shows the UTC time, which has caused confusion. However, saving and retrieving as UTC helps ensure consistent date and time across multiple servers. To handle this issue, the user can change the difference on the client side to reflect the local timezone.
darShan
2 Oct, 2023, 08:40

Save & Retrieve as UTC, change the difference only on the client side as per the local timezone.

gaurav_ch
2 Oct, 2023, 08:43

thanks. yeah need to do it like this but appwrite should not be saving like this if the server time is set to local timezone.

darShan
2 Oct, 2023, 08:46

Incase for multiple servers, UTC helps in consistent date & time.

gaurav_ch
2 Oct, 2023, 11:29

agree but the console is not showing the utc time and I presumed that I can add my local time date. hence the confusion.

Guille
2 Oct, 2023, 13:45

You can create a new issue with this to discuss with the community and the team

Drake
2 Oct, 2023, 20:09

it's best practice to send and retrieve as UTC and then show as local. that's exactly what the console does

Reply

Reply to this thread by joining our Discord

Reply on Discord

Need support?

Join our Discord

Get community support by joining our Discord server.

Join Discord

Get premium support

Join Appwrite Pro and get email support from our team.

Learn more