You need to sign in to do that
Don't have an account?
Format date/time from Salesforce object directly in element attribute
How can I format a date/time to the user's timezone within an attribute without creating a separate method to do it in the controller?
The outputText formatting won't work since I can't put outputText within an attribute since that's not valid XML.
For example:
<apex:repeat value="{!revisionHistory}" var="history">
<a href="/{!history.CreatedById}" title="{!history.CreatedDate}">{!history.Name}</a>
</apex:repeat>
I want something like the above but I want title to be formatted date AND time in the user's local timezone. It appears you can do this with the date via forumlas but I can't find a way to do this with the date and time without writing a special getter which isn't ideal.
Do one thing Use
Datetime.format in your controller and assign it's return vaue to a string property and then use that string in the VFP.
Example :
In your case
Thanks Shashikant. I know I can do this through the controller but I was wondering if there was a way to do it strictly in the view - that just seems a lot cleaner to me and easier to edit / deploy.
However, it seems like it may not be possible via VF or forumlas or other tricks especially with the time zone conversion (otherwise I could make a forumla to cut up the time as needed).
That right mate, Only way tha seems to solve this issue is to use controller.