Skip to main content Take our 5-minute Community Survey. Open now through 4/11/2025. Click here to participate.

I have a controller variable of time datatype.

public Time startTime{get;set;}

startTime = Time.newInstance(12,0,0,0);

Rendering the variable as is on visualforce will output as 12:00:00.000Z

I want to display this on a visualforce page in a proper time format using the outputText parameter passing technique.

I tried 

 

<apex:outputText value="{0, time, h:mm a}">

<apex:param value="{!slot.startTime}" />

</apex:outputText>

I'm getting a compile time error "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.". Anybody knows the correct syntax to get this working.

I know we can convert this variable as a datetime variable and use that instead, but wondering why Time variable does not work.

 
8 answers
Loading
0/9000