function readOnly(count){ }
Don't have an account?
Search for an answer or ask a question of the zone or Customer Support.
You need to sign in to do that
Sign in to start searching questions
Signup for a Developer Edition
Sign in to start a discussion
How can i get the timestamp fo the ORG in the Apex code?
Thanks in Advance.
Datetime dtNow = DateTime.now();
This gives you the current Date / Time in the Org.
http://www.salesforce.com/us/developer/docs/apexcode/Content/apex_methods_system_datetime.htm
DateTIme.now() 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
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 :
System.debug(Datetime.now().format());
Datetime dtNow = DateTime.now();
This gives you the current Date / Time in the Org.
http://www.salesforce.com/us/developer/docs/apexcode/Content/apex_methods_system_datetime.htm
DateTIme.now() 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
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 :
System.debug(Datetime.now().format());