now
Description: Returns the current date and time as a Date data type object.
Subject Type: No Subject
Arguments: No arguments
Return Type: Date
Examples: We can get the current date and time as a
Date data type by using the now
function: ${now()}
.
As an example, on Wednesday December 31st 2014 at 36 minutes after 3pm and 36.123 seconds
EST ${now()}
would be evaluated to be a Date type representing that
time. Since whole Expression Language expressions can only return Strings it would
formatted as Wed Dec 31 15:36:03 EST 2014
when the expression
completes.
Utilizing the toNumber method, now
can provide the current date and time as the number of milliseconds since Midnight GMT on
January 1, 1970. For instance, if instead of executing ${now()}
in the
previous example ${now():toNumber()}
was run then it would output
1453843201123
. This method provides millisecond-level precision and
provides the ability to manipulate the value.
Table 1.19. Table 19. now Examples
Expression |
Value |
|
A Date type representing the current date and time to the nearest millisecond |
|
The number of milliseconds since midnight GMT Jan 1, 1970
( |
|
A number presenting the time 24 hours ago |
|
The current year |
|
The day of the week that was yesterday, as a 3-letter abbreviation (For
example, |