You need to sign in to do that
Don't have an account?
Gavin Britto
Format Date in Visual Force page
I need Help converting 2016-01-08T19:00:00 to 01/08/2016
I want to truncate the time (19:00:00 )
This is what I wrote:
However, I get the following error: Content cannot be displayed: The value attribute on <apex:outputText> is not in a valid format. It must be a positive number, and of type Number, Date, Time, or Choice.
I then tried
That didn't work either
I want to truncate the time (19:00:00 )
This is what I wrote:
<apex:column headerValue="Event Date"> <apex:outputText value="{0,date,MM'/'dd'/'yyyy}"> <apex:param value="{!listMysticsmailMap[m].eventDateTime}" /> </apex:outputText> </apex:column>
However, I get the following error: Content cannot be displayed: The value attribute on <apex:outputText> is not in a valid format. It must be a positive number, and of type Number, Date, Time, or Choice.
I then tried
<apex:outputText value="{0,date,MM/dd/yyyy}">
That didn't work either
It seems that issue is not with apex:outputText. I think your map is creating problem here. I am wondering if this works with map collection in visualforce pages. Can you try this with creating a simple datetime variable in wrapper or some other way around this.
All Answers
Just a little modification in your code.
Let me know if it works for you.
Regards,
Naval
Thank you for looking into my formatting challenge. I did try that and it still gave me the error "Content cannot be displayed: The value attribute on <apex:outputText> is not in a valid format. It must be a positive number, and of type Number, Date, Time, or Choice."
I think the conversion is failing because 2016-01-08T19:00:00 <-- this time element
I need to convert to MM/dd/yyyy or truncate the T19:00:00
Any advice on this will be greatly appreciated
It seems that issue is not with apex:outputText. I think your map is creating problem here. I am wondering if this works with map collection in visualforce pages. Can you try this with creating a simple datetime variable in wrapper or some other way around this.
I see that you resolved this issue. But for futur, you may also use the Help and Training tab in the upper right corner. Give this link a shot as well. All thes best
https://developer.salesforce.com/forums?id=906F000000097k0IAA
public String eventDateTime{get;set;}
So its trying to convert a string into date. So if I declare the eventDateTime Map to return a date value, would it work?
You can give it a shot but sometimes this formatting doesn't work with Maps.
Thanks,
Naval