In order to get the Current date and time in the managed bean, include the below method –/**
* Get Current Date
public Date getCurrentDateTime()
return new Date(new java.sql.Timestamp(System.currentTimeMillis()));
The above method getCurrentDateTime() returns the Date value. You can use this method anytime, where you want the current Date and Time.