You need to sign in to do that
Don't have an account?

System.Now() and Time Zone
Hi experts,
If I issue the following command in an apex class ...
...the datetime it returns belongs to which time zone?
It returned me "Thu May 01 07:40:07 GMT 2008" when I tested on Thursday 05/01/2008 at 1:25PM. Which is correct according to my timezone location.
(my time zone location is "(GMT+05:45) Kathmandu")
Does it always return GMT time? Or it depends on some settings? If so, what is the place of the setting? How do I access that via code?
Also, is there any method like one in javascript "getTimezoneOffset()"?
According to JavaScript guide:
The getTimezoneOffset() method returns the number of minutes that the current time zone is ahead or behind UTC. For instance, getTimezoneOffset() returns 300 for U.S. Eastern Daylight Saving Time, which is 5 hours (or 300 minutes) behind UTC.
Thanks,
-Roshan
If I issue the following command in an apex class ...
Code:
DateTime d = System.now(); return d;
...the datetime it returns belongs to which time zone?
It returned me "Thu May 01 07:40:07 GMT 2008" when I tested on Thursday 05/01/2008 at 1:25PM. Which is correct according to my timezone location.
(my time zone location is "(GMT+05:45) Kathmandu")
Does it always return GMT time? Or it depends on some settings? If so, what is the place of the setting? How do I access that via code?
Also, is there any method like one in javascript "getTimezoneOffset()"?
According to JavaScript guide:
The getTimezoneOffset() method returns the number of minutes that the current time zone is ahead or behind UTC. For instance, getTimezoneOffset() returns 300 for U.S. Eastern Daylight Saving Time, which is 5 hours (or 300 minutes) behind UTC.
Thanks,
-Roshan
http://www.salesforce.com/us/developer/docs/apexcode/index.htm
then search for datetime
The url is stale, please provide an updated one.
Yes, I too have this question?
From the a given login, when I check the value in Salesforce Application, I see the datetime in user's timezone, but using the same login when I run a SOQL in Apex Explorer the value is not in GMT.
Can anyone throw more light on System.now()
(Assuming same login)
In the above eg. What is the time zone that is stored in variable d ?
If this variable value is inserted into a custom field of type DateTime what what is the value stored in the object?
Thanks for your help.