Visualforce: how to print the current date?

How to print the current date in Visualforce?

Things like Today (), System.now, do not work.

Could not find any documents or problems with stackoverflow on this.

+4
source share
2 answers

In your controller, create a property:

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

On the VF page, try using:

 <apex:outputText value="{0,date}"> <apex:param value="{!Today}" /> </apex:outputText> 

Details on date formatting can be found here and here .

+5
source

Visualforce also has Data and Time functions, you can use {! NOW ()} or {! TODAY ()}.

See here for more details.

+16
source

Source: https://habr.com/ru/post/1394072/


All Articles