You need to sign in to do that
Don't have an account?

Showing date time with Apex:outputtext
Hi All,
I am trying to show date time with Apex:outputtext using the below code:
<apex:outputText value=" {0,date,MM/dd/yy HH:mm a}">
<apex:param value="<DateTime field>"/></apex:outputText>
The result of this is date is coming in GMT timezone. Please let me know how can we show it in user's timezone.
thanks!
Hello Dcoder
In order to avoid this use apex class.I have created sample for your scenario.
- Suresh
All Answers
Hello Dcoder
In order to avoid this use apex class.I have created sample for your scenario.
- Suresh
Thanks Suresh!
yes, that is a workaround for this issue.
But, I was thinking if we have any way to show the time in particular timezone like CST or PST.
Does anyone else has any idea about it?
thanks!
I meant, Do we have any way to show the time in CST timezone using Outputtext ?
OuputField displays the time converted to the current users timezone.
OutputText just displays whatever is stored in the datetime object, which is normally a GMT based time. So you would need to use some apex code as in the example above to get a datetime value in the timezone you want.
okay, thanks aballard !
I am doing it through apex code now.
Were you able to to write that code Dcoder? I'm having the same issue and would like the outputText to show the time in PST. Please share your findings!
@sfuser2010
I have written an extension for that VF page, in short I am storing the date in string variable in that extension and showing that string variable on the VF page.