You need to sign in to do that
Don't have an account?
Umapen
date format on visual force page
In my visual force page I have the following line that display date : 1/21/2010 9:37 PM
<apex:outputField value="{!invitation.Account_group__r.Submission_Due_Date__c}"/>
I want to display date as : Jan 21, 2010 9.37 PM pst
Do I have to convert to string in my controller and display parsed data in visual force page?
or
Is there any format that I can give in my style(css) that will display date in the format I want?
Thanks
It's all about the matter of one 'space'. If you insert the space in value attribute of outputField like:
<apex:outputField value=" {!invitation.Account_group__r.Submission_Due_Date__c}"/>
it will display time in your local timezone and if you remove the space from it like this:
<apex:outputField value="{!invitation.Account_group__r.Submission_Due_Date__c}"/>
it will display time in GMT format.
All Answers
Here is the posting I found for DateTime format, but do not know how to do the date only field format.
http://community.salesforce.com/sforce/board/message?board.id=apex&message.id=7876
Date Dt = invitation.start_date__c;
String starDate = dt.format('mmm d); not working error in format
I don't think you can format a date like that - you'll have to convert it to a date time and format that.
public String getTravelstartDate(){ String TrvstartDate=' '; DateTime Dt = DateTime.valueOf(invitation.Travel_start_date__c +' 00:00:00'); TrvstartDate = Dt.format('MMM d, yyyy'); return TrvstartDate; }
Here is the link to more from documentation for more examples of DateTime format http://java.sun.com/j2se/1.4.2/docs/api/java/text/SimpleDateFormat.html
<apex:outputText value="{!TravelstartDate}" />
Hi All,
You can also do:
<apex:outputText value="Dated: {0,date,E MMM d yyyy}"> <apex:param value="{!NOW()}" /> </apex:outputText>
Format codes in above post link to Java site.
Hi,
I also use the following;
It's all about the matter of one 'space'. If you insert the space in value attribute of outputField like:
<apex:outputField value=" {!invitation.Account_group__r.Submission_Due_Date__c}"/>
it will display time in your local timezone and if you remove the space from it like this:
<apex:outputField value="{!invitation.Account_group__r.Submission_Due_Date__c}"/>
it will display time in GMT format.
<apex:outputText value=" {!dto.o.Amount}">
</apex:outputText>
I did this on the amount field. but unfortunately when amount is long. ex. 10000000 this will be converted to exponetial number results like 1.0E+7. is there's way to fix this?
" It's all about the matter of one 'space'. If you insert the space in value attribute of outputField like:
<apex:outputField value=" {!invitation.Account_group__r.Submission_Due_Date__c}"/>
it will display time in your local timezone and if you remove the space from it like this:
<apex:outputField value="{!invitation.Account_group__r.Submission_Due_Date__c}"/>
it will display time in GMT format. "
You nailed it! And what an easy fix. Thanks!