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.
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 hoursThanks 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!
User | Count |
---|---|
44 | |
29 | |
22 | |
20 | |
14 |