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
Arun BArun B 

How to retrieve date in yyyy-MM-dd format ..

Hello there,
I wanted to retrieve the createdDate field of an object in the yyyy-MM-dd format using SOQL : I don't want the timestamp and the timezone information. Can someone help me here ?

My current query:
Select CreatedDate,Requested_Role__c,Status__c,Start_Date__c,Description__c from Resource_Assignment__c where Related_Account__c='0014000000HrC0RAAV' and PSOD_Project__c = 'SSP Resource Request'

Arun B

Even though it's called createdDate it's in Date Time format.

You will need to use the format method to get back the date in yyyy-MM-dd format.

Look under the Datetime methods in the Apex developers guide for an explanation of the format method.