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
cmxintcmxint 

Probs while query DateTime field

Hi guys, it's me again.

I still can't get how to query date/time field. It's written in documentation that SFDC API can recognize fieldExpression for date/time fields in format "YYYY-MM-DDTHH:MM:SSZ". I use this mask in my query but didn't get any results . I have date/time field in custom object with a value "2004/10/13 12:00 AM" - that's what I see using view in UI. Timezone settings is "GMT-05:00 New York/America". Here is my query which I use to get object ID:

string queryString = "SELECT Id FROM Volume__c WHERE Trade_Date__c=2004-10-13T00:00:00Z". It doesn't return any record. When I specify timezone:

string queryString = "SELECT Id FROM Volume__c WHERE Trade_Date__c=2004-10-13T00:00:00-05:00Z" this query doesn't return any values.

Only when I changed time part of query (than it looks like "SELECT Id FROM Volume__c WHERE Trade_Date__c=2004-10-13T04:00:00Z"), it return my record. I can't got logic of this action - if I have GMT-05:00 then why should I specify 04:00:00 in time part of the query???

And may be there are some useful advices about how to handle such a fields???

Message Edited by cmxint on 11-30-2004 06:24 AM

SuperfellSuperfell
Because on 10/13 EST is in daylight savings time, so is only 4 hours from UTC.
cmxintcmxint

Hi SimonF!

Thanks for both of your comments - they are really helpful! By the way - does sForce going to have some features to ease TZ handling?