You need to sign in to do that
Don't have an account?
Jerun Jose
apex:outputtext to display time variable
I have a controller variable of time datatype.
I want to display this on a visualforce page in a proper time format using the outputText parameter passing technique.
I tried
I know we can convert this variable as a datetime variable and use that instead, but wondering why Time variable does not work.
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.
Would be good to know the solution tough!
<apex:outputText value="{0,date,dd/MM/yyyy}">
<apex:param value="{!slot.startTime}" />
</apex:outputText>
Let me know if it works !
<apex:outputField value="{!slot.startTime}"/> or
<apex:outputText value=" {!slot.startTime}"/> (Can you see the space between " { ?)
{!HOUR(item.Interview_time__c)}:
<apex:outputText value="{0,number,00}">
<apex:param value="{!Minute(item.Interview_time__c)}" />
</apex:outputText>
<apex:outputText rendered="{!HOUR(item.Interview_time__c)<12}">
AM
</apex:outputText>
<apex:outputText rendered="{!NOT(HOUR(item.Interview_time__c)<12)}">
PM
</apex:outputText>