I wanted to display CST instead (America/Chicago) in the view. I have a TimeZoneSidKey But not sure how to get the Short Name (CST) of the timezone by using the TimeZoneSidKey .

  • What have you tried? You will need to set up your own transformation table for the values. Jun 16, 2020 at 18:25

1 Answer 1


@RKCY Is your view custom or out of the box? Salesforce Timezone class won't provide you what you are looking for and rightfully so because short names are different depending upon the dates. They show CDT vs CST (Daylight Time vs Standard Time). Also, America/Phoenix has two different timezones depending on which day you are referencing to. Static map of values wont work either.

Here's a custom code

DateTime dtMydateTime = System.now();
String DATE_TIME_FORMAT_HOUR_MIN_SEC = 'MM/dd/yyyy hh:mm:ss a z';

String strDateTimeWithTimezone =  dtMydateTime.format(DATE_TIME_FORMAT_HOUR_MIN_SEC, UserInfo.getTimeZone().toString());

Reference: https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_methods_system_timezone.htm


Not the answer you're looking for? Browse other questions tagged .