How to get the current User time zone in an Apex class?

How to get the current User time zone in an Apex class?

UserInfo.getTimeZone() can be used to get the current User time zone in an Apex class.

Use the following code for your reference.

Sample Code:

TimeZone tz = UserInfo.getTimeZone();
System.debug( 
    tz 
);

So, UserInfo.getTimeZone() can be utilized to get the current user time zone in Salesforce Apex. Check the following for Business Hours check.

Leave a Reply