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

How to get date in particular format in SOQL query

i have a method in my code 

public List<Meeting_ActionItem__c> getActionItem1(){
return [SELECT Action_Item_Description__c,project__c,Status__c,Date_Assigned__c,Due_Date__c,assigned_to__c FROM Meeting_ActionItem__c where



its a controller class i am using this list in <apex:dataTable> in Date_Assigned__c i am getting date in format  Thu Feb 28 00:00:00 GMT 2013 but i want it in this format YYYY-MM-DD


i was searching go through this link

last solution in this link is showing is copying all fields to a different object in different date format .i doubt if there are suppose 100,000 then it will take considerable time for copying fields .please suggest any other efficient solution 

Best Answer chosen by Admin (Salesforce Developers) 
Thiyagarajan SelvarajThiyagarajan Selvaraj

In your visual force page, try this for displaying date
    <apex:outputText value="{0,date,yyyy'-'MM'-'dd}" >
        <apex:param value="{!varName.Date_Assigned__c}" />