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

Timestamp of the Org

How can i get the timestamp fo the ORG in the Apex code?


Thanks in Advance.

Ritesh AswaneyRitesh Aswaney

Datetime dtNow =;


This gives you the current Date / Time in the Org.

8hrWait8hrWait gives the timestamp in GMT.

I want the timestamp of the ORG i.e. the time stamp according to the time zone present under Company Information.


To get the Company Information  -

Set Up -> Administartion Set up -> Company Profile -> Company Information -> Default Time Zone

Ritesh AswaneyRitesh Aswaney

The time in Salesforce is always in GMT (UTC). That's how it is stored in the CreatedDate, etc fields in the database.

It is corrected to the User's timezone when it is displayed.


To get it in the local time zone of the executing user :