You need to sign in to do that
Don't have an account?
Date formatting in SOQL Query
This is my controller class in which I am directly inserting my queryl
public class WBSDataTableController { public List<Tasks__c> WBSList { get { if (WBSList == null) { WBSList = [SELECT Task_Name__c, Start_Date__c, Project__r.Name FROM Tasks__c WHERE Project__r.Name = 'P-005']; } return WBSList; } set; } }
Now when I call my Start_Date__c field which is a Date type field, in HTML like this :
<apex:repeat value="{!WBSList}" var="tasks"> <tr> <td>{!tasks.Task_Name__c}</td> <td>{!tasks.Start_Date__c}</td> </tr> </apex:repeat>
It shows me this value :
Tue Feb 17 00:00:00 GMT 2015
whereas I only want the value like this :
17 Feb 2015
I know that there is an option to break it down in using date time instance but I want to add the formatted date straight into my WBSList variable.
Any quick fixes for this?
I hope this will help
Please close the thread marking this answer as Best Answer if it really helped. Closing the thread help others finding the correct answer.
All Answers
I hope this will help
Please close the thread marking this answer as Best Answer if it really helped. Closing the thread help others finding the correct answer.
<apex:repeat value="{!WBSList}" var="tasks">
<tr>
<td>{!tasks.Task_Name__c}</td>
<td>
<apex:outputText value="{0, date, d MMM yyyy}">
<apex:param value="{!tasks.Start_Date__c}" />
</apex:outputText>
</td>
</tr>
</apex:repeat>
for more format try this url : https://help.salesforce.com/apex/HTViewSolution?id=000206537&language=en_US
If this answers your question then hit Like and mark it as solution!