0 votes
1 view
in Salesforce by (11.9k points)

How do I print the current date on Visualforce?

Stuff like Today(), System.now, doesn't work.

Haven't been able to find any documentation or stackoverflow questions regarding this subject.

1 Answer

0 votes
by (31.8k points)

You need to create a property in your controller like:

public Date Today { get { return Date.today(); }}

When you're using the VF page, use the following piece of code:

<apex:outputText value="{0,date}">

    <apex:param value="{!Today}" />

</apex:outputText>

Welcome to Intellipaat Community. Get your technical queries answered by top developers !


Categories

...