@Hour (JavaScript)

Returns the hour from a date and time.

Defined in

@Functions (JavaScript)

Syntax

@Hour(time:Date) : int
Parameter Description
time A date and time.
Return value Description
int The hour of 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());