Is there a limitation that prevent filtering SOQL queries on custom date fields?

This query works;

SELECT Id FROM SomeObject__c WHERE CreatedDate >= 2012-12-27T00:00:00Z

This one;

SELECT Id FROM SomeObject__c WHERE CustomDate__c >= 2012-12-27T00:00:00Z

Returns the error

value of filter criterion for field 'CustomDate__c ' must be of type date and should not be enclosed in quotes.

...I've double check that CustomDate__c is a date field.

  • Is it "Date" or "Date/time" the query needs to be written specific to the data type.
    – HomerJ
    Feb 9, 2015 at 20:29
  • It is a [Date] field
    – Christoph
    Feb 9, 2015 at 20:31
  • you are comparing date field to datetime. Remove the time.
    – cartman
    Feb 9, 2015 at 20:34

1 Answer 1


Try this:

SELECT Id FROM SomeObject__c WHERE CustomDate__c >= 2012-12-27

and see if it works. If so, the Custom_Date__c field is Date, not Date/Time, and requires a different where statement to resolve.

  • 1
    THanks HomerJ, that works and feeling rather silly now. Will accept and leave question in case someone else gets hung up on the same thing.
    – Christoph
    Feb 9, 2015 at 20:35

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .