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
WenLong TanWenLong Tan 

How to avoid SFDC year defect and get correct year of current date

Hi, 

Recently we met a issue that if login user's locale is Thailand, current date's year will become Buddhist calendor 2559 instead of 2016, it is a known issue of Salesforce, see https://success.salesforce.com/issues_view?id=a1p3A000000IXkpQAG
Is there anyone know how to avoid this defect and get correct year of current date even login user's locale is Thailand?

Thanks & regards,
WenLong Tan
Best Answer chosen by WenLong Tan
Damon LimDamon Lim
Hi Wenlong,

You can get system year by printing it. If you need it in Integer format, you can do it this way:
 
Integer year = Integer.valueOf(Datetime.now().format('yyyy'));

This way, the year you get will not be affected by Thai locale.

All Answers

Naveen DhanarajNaveen Dhanaraj
Hi WenLong Tan,
This is not possible
 
Naveen DhanarajNaveen Dhanaraj
++,Good to Know: Changing the locale on the User detail page will affect the language used in the Calendar. However, other areas of the platform will still respect the default language. For example, if your language is set to English (United States) and you update your locale to Dutch, the language on the Calendar will be set to Dutch. 

check out this--https://help.salesforce.com/articleView?id=000004385&language=en_US&type=1
Damon LimDamon Lim
Hi Wenlong,

You can get system year by printing it. If you need it in Integer format, you can do it this way:
 
Integer year = Integer.valueOf(Datetime.now().format('yyyy'));

This way, the year you get will not be affected by Thai locale.
This was selected as the best answer