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
bytor1971bytor1971 

Formatting a Date in SOQL

I am attempting to format a datetime object queried in an SOQL statement.  However, the format method of the dateTime object is not accepted and I receive an unexpected token error and the token is the open parenthesis of the following excerpt.

 

select Start_Time__c.format('DD-MMM-YYYY')

 

Am I not invoking the method of the dateTime object correctly?

 

Thanks

JimRaeJimRae
You can't reformat the field directly in the query. You will need to do the formatting to the results instead.
bytor1971bytor1971
That's what I feared.  I was hoping that the O in SOQL stood for object.  ;-)