Localization for date

Hello Guys, I built a app, which is used in multiple countries and iโ€™m using database for storage. I want to make my app user friendly i.e want to show the date format based on the country users sign in as. For example if a user is from USA date format should be-mm/dd/yyyy & if a user is from India the date should be displayed in the format of dd/mm/yyyy. Do we have any current functionality where i can achieve this.
Thank you.

0 8 411
8 REPLIES 8

Hi! Yes, this can be done. You can use UTCNOW() to record the date/times and then adjust such date/times to ones appropriate to the userโ€™s device with the duration UTCNOW() - NOW(). I wrote about this at the following address but my explanation is excessively complicated because I was still learning when I started writing:

USERTZOFFSET() is probably NOT the best method.

thanks @Kirk_Masden, i would like to change the visual format of date column based on logged in user country.
Ex: User logs from USA: mm/dd/yyyy
User logs from India: dd/mm/yyyy

Iโ€™m not sure of a good way to do it if there are different countries in the same time zone that require different formats, but I think you could have different formats based on time zones. For example,

=now()-utcnow()

Yields 9:00:00 for me because Iโ€™m in Japan. I could use an if statement to format the date for Japan:

if(now()-utcnow()=โ€œ09:00:00โ€-โ€œ00:00:00โ€, if yes format expression, if no format expression)

By the way, you need to subtract with โ€œ00:00:00โ€ for AppSheet to recognize โ€œ09:00:00โ€ as a duration.

Or:

if(now()-utcnow()=โ€œ009:00:00โ€, if yes format expression, if no format expression)

That third digit in the hours position indicates a Duration value.

  • "09:00:00": Time: 9:00 AM
  • "009:00:00": Duration: 9 hours

Thanks for the correction!

By the way, @Steve, itโ€™s clear that using โ€œ009:00:00โ€ is preferable. I wonder, though, if โ€œ09:00:00โ€-โ€œ00:00:00โ€ wasnโ€™t also doing the work of making it a duration. I tried it out and it seemed to be working.

Yes, it definitely worked just fine!

100% accurate!

Steve
Platinum 4
Platinum 4
Top Labels in this Space