function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion

How to know date format of Users

How to know the date format of the user in salesforce. Basically I want to perform some operation based on user's date format.
If(date_format == dd/mm/yyyy) 
{ do this } 
if(date_format == mm/dd//yyyy) 
​{ do this }

I know we can use Map to store the locale as key and date format as values and then query the locale and get the date format, but it is very lengthy and it will also increase the no. of lines in code.
Anup JadhavAnup Jadhav
Perhaps a more useful implementation would be to check the user's locale (us, uk) instead of dates, which i am pretty sure is translated into a common format in apex. 

You can see more details on the user locale here -