@Time (JavaScript)

Creates a date and time.

Defined in

@Functions (JavaScript)

Syntax

@Time(date:Date) : Date

@Time(years:int, months:int, days:int, hours:int, minutes:int, seconds:int) : Date

@Time(hours:int, minutes:int, seconds:int) : Date

Parameter Description
date A date and time.
years Year of the date and time.
months Month of the date and time.
days Day of the date and time.
hours Hour of the date and time.
minutes Minute of the date and time.
seconds Second of the date and time.
Return value Description
Date The new date and time.

Usage

This function provides the date and time as follows:
  • If the parameter list specifies a Date object, this function uses only the time portion and sets the date to 1/1/1900.
  • If the parameter list specifies hours, minutes, and seconds, this function sets the time as specified and sets the date to 1/1/1900.
  • If the parameter list specifies years, months, days, hours, minutes, and seconds, this function sets the date and time as specified.

Examples

(1) This example constructs a date and time from a Date object.
function p(stuff) {
	print("<<<" + stuff + ">>>");
}

var now = @Now();
var time1 = @Time(now);
p("Now = " + now);
p("Time = " + time1);p("Now = " + now); // <<<Now = 4/11/06 9:35 AM>>>
p("Date = " + date1); // <<<Time = 1/1/00 9:35 AM>>>

(2) This example constructs a date and time by using the month, day, and time from @Now and specifying the year literally.

function p(stuff) {
	print("<<<" + stuff + ">>>");
}

var now = @Now();
var month = @Month(now);
var day = @Day(now);
var hour = @Hour(now);
var minute = @Minute(now);
var second = @Second(now);
var time1 = @Time(1999, month, day, hour, minute, second);
p("Now = " + now);
p("Time = " + time1);
<<<Now = 4/11/06 9:59 AM>>>
<<<Time = 4/11/99 9:59 AM>>>