You need to sign in to do that
Don't have an account?
GraceW
Need help with Event ActivityDateTime
Hi,
I set up a new event on Salesforce GUI at 8:00 AM, 12/21/2006, when I took a look in your stored data via the Eclipse plugin, it is stored as Thu Dec 21 10:00:00 CST 2006. When I query the Event, the returned string shows 2006-12-21T16:00:00.000Z. My Time zone is CST.
So my question is what conversion I need to do in order to correctly translate the returned string from the query?
According to the api:
I set up a new event on Salesforce GUI at 8:00 AM, 12/21/2006, when I took a look in your stored data via the Eclipse plugin, it is stored as Thu Dec 21 10:00:00 CST 2006. When I query the Event, the returned string shows 2006-12-21T16:00:00.000Z. My Time zone is CST.
So my question is what conversion I need to do in order to correctly translate the returned string from the query?
According to the api:
Date/time values (timestamps). Fields of this type handle
date/time values (timestamps), such as ActivityDateTime
in the Event object or the
CreatedDate, LastModifiedDate, or SystemModstamp in many objects. Regular dateTime
fields are full timestamps with a precision of one second. They are always
transferred in the GMT/UTC time zone. In your client application, you might need
to translate the timestamp to or from a local time zone.
So does that mean if I set up a new event for 8:00 AM, 12/21/2006 in my client application, I need to first convert it to GMT time before I put it into new QName("ActivityDateTime"), " yyyy-MM-ddTHH:mm:ssZ"); , and when I received something back from the query, like the above 2006-12-21T16:00:00.000Z, it is the time in GMT time zone?
What is the tailing 000Z anyway?
Thanks for your help.
So does that mean if I set up a new event for 8:00 AM, 12/21/2006 in my client application, I need to first convert it to GMT time before I put it into new QName("ActivityDateTime"), " yyyy-MM-ddTHH:mm:ssZ"); , and when I received something back from the query, like the above 2006-12-21T16:00:00.000Z, it is the time in GMT time zone?
What is the tailing 000Z anyway?
Thanks for your help.
See ISO8601 and/or the section on the dateTime datatype in the xml schema specification for more details.
Thanks for your help!
So for the returned string 2006-12-21T16:00:00.000Z, can I just truncate the ".000Z", and assume that "2006-12-21T16:00:00" is the GMT time, but if I do so, I can only get 10:00am CST, not the correct 8:00am CST. Am I wrong somewhere?
Thanks!
I take SimonF's point above, that when we set dateTimes through the API we need to explicitly set the time offset. The problem is though that we don't always know the correct offset to use. I know that might sound odd, so here's an example.
In my app the user can set a Task with a reminder. I create the Task through the API, via code on my webserver. When the user sets the reminder dateTime in my app's UI, they will naturally assume that they can enter a time in the timezone set in their SF user profile. For example if a user enters a reminder time of 9:00am in my app's UI, and their salesforce user profile says that their timezone is "GMT-05:00 Eastern Standard Time America/Indianapolis", then of course the user means 9am EST not 9am UTC. The problem is that when creating the task through the API, I can't find a way to look up the user's timezone from their SF user profile and work out what offset I need to apply, because the API only provides getUserInfo().userTimeZone as a string value (in this case the userTimeZone value would be "America/Indianapolis"). There appears to be no way to convert this string value into the required +/-hh:mm offset required. Similarly, I can see no way to read the time offset throuugh other routes (e.g. using inline s-control params).
Clearly there is a feature somewhere within the SF system that does this timezoneString-to-timeOffset conversion implicitly. But is that capability exposed to app developer through the API too? I'm kind of hoping that it's there but I've just overlooked it :-)
Thanks.
PS: posters to other threads have suggested using Javascript to detect the timezone offset from the user's PC's regional settings. This is certainly quite an inventive workaround, but in the end is not reliable. After all, the PC's region settings might not match the timezone in the SF user profile, and some users will use more than one PC to access salesforce, not all of which might have the same region settings, and not all of which the user might be able to change.