You need to sign in to do that
Don't have an account?
kiran punuru
Remove time format from date field
Hi All,
I have one field startdate__c which is of type date field when iam using this field in the soql query and displaying that field it is giving the format like : 2016-05-03 00:00:00 .How can i remove 00:00:00 and display only date ? Can someone advise .
Thanks,
Kiran
I have one field startdate__c which is of type date field when iam using this field in the soql query and displaying that field it is giving the format like : 2016-05-03 00:00:00 .How can i remove 00:00:00 and display only date ? Can someone advise .
Thanks,
Kiran
Hi,
In Apex, you can achieve the same by converting datetime values to date.
DateTime dT = System.now();
Date myDate = date.newinstance(dT.year(), dT.month(), dT.day());
OR you can use Function DATEVALUE, Like:
DATEVALUE(startdate__c);
Hope this helps. Kindly mark as Solved if this resolves your issue.
Regards
Veenesh
http://salesforce.stackexchange.com/questions/22321/visualforce-date-formatting
------------
Thanks,
Srinivas
- Please mark as solution if your problem is resolved.
Use following code, to get only date variation:
replace objectVariableName with actual sObject name.
If this helps you out, please mark this as Best Answer.
I have used apex:outputText for formatting on VF pages. It works well.
<apex:page>
2 <apex:outputText value="The unformatted time right now is: {!NOW()}" />
3 <br/>
4 <apex:outputText value="The formatted time right now is:
5 {0,date,yyyy.MM.dd G 'at' HH:mm:ss z}">
6 <apex:param value="{!NOW()}" />
7 </apex:outputText>
8</apex:page>
Doc to give you more info:
https://developer.salesforce.com/docs/atlas.en-us.pages.meta/pages/pages_compref_outputText.htm
Hope this helps.
Regards,
CloudSavvyProg
startdate__c.format()
If we convert Date field to string it will remove time string from date and we can use same string in query. This looks simple to me.
Thanks,
Zaman