function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Terry411Terry411 

DateTime Format

I'm using a custom controller and having trouble getting the date/time field to display correctly.

 

<apex:outputLabel value="Class Date" for="ClassDate"/>
<apex:inputText id="ClassDate" value="{!ClassDateTime}"/>

 The field displays as 'Mon Mar 07 10:20:00 GMT 2011'

 

I need this to display, in the correct timezone (SCT), with a 'yyyy-MM-dd HH:mm:ss' format. 

 

TehNrdTehNrd

Try changing apex:inputText to apex:inputField.

Terry411Terry411

I thought an InputField would require a sObject.  Is that not the case or is there a way to use an sObject with a custom controller?

TehNrdTehNrd

Yes, you are correct. You maybe able to use the object field as a variable instead of binding directly to a dataTime variable. This thread may also assist but I'm not sure if it works for input fields: http://boards.developerforce.com/t5/Visualforce-Development/Formatting-Datetime-Objects-in-VisualForce-how-to/m-p/111504#M9820