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.

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.

3 Likes

https://help.appsheet.com/en/?q=localization

3 Likes

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

1 Like

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.

1 Like

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
3 Likes

Thanks for the correction!

1 Like

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!

3 Likes