@Now (JavaScript)
Returns the server date and time.
Defined in
@Functions (JavaScript)Syntax
@Now() : Date
Return value | Description |
---|---|
Date |
The current date and time in the server time zone. |
Usage
This function provides both the date and time.Examples
This example constructs a date and time 24 hours before the current time by using the date from@Yesterday
and
the time from @Now
.function p(stuff) {
print("<<<" + stuff + ">>>");
}
var date1 = @Yesterday();
var year = @Year(date1);
var month = @Month(date1);
var day = @Day(date1);
var date2 = @Now();
var hour = @Hour(date2);
var minute = @Minute(date2);
var second = @Second(date2);
var yesterday = @Date(year, month, day, hour, minute, second);
p("24 hours ago = " + yesterday.toLocaleString());