@Yesterday (JavaScript)
Returns yesterday's date.
Defined in
@Functions (JavaScript)Syntax
@Yesterday() : Date
Return value | Description |
---|---|
Date |
Yesterday's date. |
Usage
This function provides only a date. The time is set to 0 hours.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());