You need to sign in to do that
Don't have an account?
ltcommander
SOQL Timezone question
Hi guys,
I see so much info on this but I am still unable to figure it out!
Our SF set up is Hong Kong. So, all times (LastModifiedDate, etc) are saved and displayed on SF as per the HK timezone..
I am trying to use SOQL to retrieve data.
my $result = $sforce->do_query("Select LastModifiedDate,Id,Name From Job__c where LastModifiedDate>=2018-01-17T00:00:00.000Z and LastModifiedDate<=2018-01-17T23:59:00.000Z" );
Does the above mean 17th Jan from 00:00 to 2359 UTC?
HK is in the +8 timezone. So if I want to see the records created during the day of 17th Jan as per the HK timezone how would I modify the DateTime part? Supposed to be easy but I am still struggling with it!
Thanks!
I see so much info on this but I am still unable to figure it out!
Our SF set up is Hong Kong. So, all times (LastModifiedDate, etc) are saved and displayed on SF as per the HK timezone..
I am trying to use SOQL to retrieve data.
my $result = $sforce->do_query("Select LastModifiedDate,Id,Name From Job__c where LastModifiedDate>=2018-01-17T00:00:00.000Z and LastModifiedDate<=2018-01-17T23:59:00.000Z" );
Does the above mean 17th Jan from 00:00 to 2359 UTC?
HK is in the +8 timezone. So if I want to see the records created during the day of 17th Jan as per the HK timezone how would I modify the DateTime part? Supposed to be easy but I am still struggling with it!
Thanks!
my $result = $sforce->do_query("Select LastModifiedDate,Id,Name From Job__c where LastModifiedDate>=2018-01-17T00:00:00.000Z and LastModifiedDate<=2018-01-17T23:59:00.000Z" );
will only bring up records created on the 17th (Hong Kong timezone) ?
Thank you
dateTime field values are stored as Coordinated Universal Time (UTC). When a dateTime value is returned in Salesforce, it’s adjusted for the time zone specified in your org preferences. SOQL queries, however, return dateTime field values as UTC values. If you want to process these values in different time zones, your application might need to handle the conversion.
Refer this link
Select id from lead where createddate = TODAY
observation: returns results based on the logged in user timze zone. So the count of records from this query will vary based on the timezone of the user
So instead of using the date literal 'Today' you can try using the date format in the query
Select id from lead where createddate = 2018-11-27T05:00:00.000z
observation: returns results based on the defined date. The date here refers to the UTC date. It does not take logged in user time zone or the org timezone. The count remains same irrespective of logged in user timezone.
If the users are spread across timezones (e.g. EST, MST, CST, PST) and if you need records created based on EST timezone (instead of UTC 00:00), you can adjust the above query to
Select id from lead where createddate = 2018-11-27T05:00:00-05:00. The last part "-05:00" is the offset that needs to be applied based on UTC base timezone. Note: The offset needs to be adjusted based on DLS