Date Class Reference
[ECMAScript/QtScript - Native Objects]

ECMAScript Date prototype object. More...

Inheritance diagram for Date:

Object List of all members.

Constructors

 Date (Number year, Number month, Number day, Number hour=0, Number minutes=0, Number seconds=0, Number milliseconds=0)
 Date (Number milliseconds)
 Date (String dateTime)
 Date ()

Methods

Number getDate ()
Number getDay ()
Number getFullYear ()
Number getHours ()
Number getMilliseconds ()
Number getMinutes ()
Number getMonth ()
Number getSeconds ()
Number getTime ()
Number getTimezoneOffset ()
Number getUTCDate ()
Number getUTCDay ()
Number getUTCFullYear ()
Number getUTCHours ()
Number getUTCMilliseconds ()
Number getUTCMinutes ()
Number getUTCMonth ()
Number getUTCSeconds ()
Number getYear ()
void setDate (Number dayOfTheMonth)
void setFullYear (Number year[,...])
void setHours (Number hours[,...])
void setMilliseconds (Number milliseconds)
void setMinutes (Number minutes[,...])
void setMonth (Number month[,...])
void setSeconds (Number seconds[,...])
void setTime (Number milliseconds)
void setUTCDate (Number dayOfTheMonth)
void setUTCFullYear (Number year[,...])
void setUTCHours (Number hours[,...])
void setUTCMilliseconds (Number milliseconds)
void setUTCMinutes (Number minutes[,...])
void setUTCMonth (Number month[,...])
void setUTCSeconds (Number seconds[,...])
void setYear (Number year[,...])
String toDateString ()
String toGMTString ()
String toLocaleDateString ()
String toLocaleString ()
String toLocaleTimeString ()
String toString ()
String toTimeString ()
String toUTCString ()
Number valueOf ()

Detailed Description

ECMAScript Date prototype object.

This is the DAZ Script counterpart of the QDateTime type used in the DAZ Studio SDK.

Todo:
Examples:


Constructor & Destructor Documentation

Date::Date (  ) 

Default constructor. Creates a date and initializes it with the current date and time.

Date::Date ( String  dateTime  ) 

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. Creates a date from the formatted date string.

Parameters:
dateTime The date string to create the date from

Date::Date ( Number  milliseconds  ) 

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. Creates a date from a timestamp

Parameters:
milliseconds The number of milliseconds after January 1st 1970

Date::Date ( Number  year,
Number  month,
Number  day,
Number  hour = 0,
Number  minutes = 0,
Number  seconds = 0,
Number  milliseconds = 0 
)

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. Creates a date with the given year, month, day; and optionally, hour, minutes, seconds, and milliseconds.

Parameters:
year The year for the date
month The month of the year [1 - 12]
day The day of the month [1 - 31]
hour The hour of the day [0 - 23]
minutes The number of minutes [0 - 59]
seconds The number of seconds [0 - 59]
milliseconds The number of milliseconds [0 - 999]
Example:
EXAMPLE


Member Function Documentation

Number Date::getDate (  ) 

Returns:
The day of the month; in the range [1 - 31].
Example:
        var oDate = new Date( 2005, 7, 15, 12, 30 );
        var nDate = oDate.getDate();
        // nDate == 15

Number Date::getDay (  ) 

Returns:
A number that represents the day of the week; in the range [0 - 6], where Sunday is 0.
Example:
        var oDate = new Date( 2005, 7, 15, 12, 30 );
        var nDay = oDate.getDay();
        // nDay == 1

Number Date::getFullYear (  ) 

Returns:
A four digit number that represents a year.
Example:
        var oDate = new Date( 2005, 7, 15, 12, 30 );
        var nYear = oDate.getFullYear();
        // nYear == 2005

Number Date::getHours (  ) 

Returns:
The hours of a time; in the range [0 - 23].
Example:
        var oDate = new Date( 2005, 7, 15, 12, 30 );
        var nHour = oDate.getHours();
        // nHour == 12

Number Date::getMilliseconds (  ) 

Returns:
The milliseconds of a time; in the range [0 - 999].

Number Date::getMinutes (  ) 

Returns:
The minutes of a time; in the range [0 - 59].
Example:
        var oDate = new Date( 2005, 7, 15, 12, 30 );
        var nMinute = oDate.getMinutes();
        // nMinute == 30

Number Date::getMonth (  ) 

Returns:
A number that represents a month; in the range [0 - 11], where January = 0.
Example:
        var oDate = new Date( 2005, 7, 15, 12, 30 );
        var nMonth = oDate.getMonth();
        // nMonth == 7

Number Date::getSeconds (  ) 

Returns:
The seconds of a time; in the range [0 - 59].
Example:
        var oDate = new Date( 2005, 7, 15, 12, 30 );
        var nSecond = oDate.getSeconds();
        // nSecond == 30

Number Date::getTime (  ) 

Returns:
The number of milliseconds since midnight on January 1st, 1970.
Example:
        var oDate = new Date( 2005, 7, 15, 12, 30 );
        var nTime = oDate.getTime();
        // nTime == 1121452200000

Number Date::getTimezoneOffset (  ) 

Returns:
A number that represents the difference in minutes between Greenwich Mean Time (GMT) and local time.
Example:
        var oDate = new Date( 2005, 7, 15, 12, 30 );
        var nTimezone = oDate.getTimezoneOffset();

Number Date::getUTCDate (  ) 

Returns:
The day of the month according to the Universal Coordinated Time (UTC); in the range [1 - 31].
Example:
        var oDate = new Date( 2005, 7, 15, 12, 30 );
        var nDate = oDate.getUTCDate();
        // nDate == 15

Number Date::getUTCDay (  ) 

Returns:
A number that represents the day of the week according to the Universal Coordinated Time (UTC); in the range [0 - 6], where Sunday is 0.
Example:
        var oDate = new Date( 2005, 7, 15, 12, 30 );
        var nDay = oDate.getUTCDay();
        // nDay == 1

Number Date::getUTCFullYear (  ) 

Returns:
A four digit number that represents a year according to the Universal Coordinated Time (UTC).
Example:
        var oDate = new Date( 2005, 7, 15, 12, 30 );
        var nYear = oDate.getUTCFullYear();
        // nYear == 2005

Number Date::getUTCHours (  ) 

Returns:
The hours of a time according to the Universal Coordinated Time (UTC); in the range [0 - 23].
Example:
        var oDate = new Date( 2005, 7, 15, 12, 30 );
        var nHour = oDate.getUTCHours();
        // nHour == 12

Number Date::getUTCMilliseconds (  ) 

Returns:
The milliseconds of a time according to the Universal Coordinated Time (UTC); in the range [0 - 999].

Number Date::getUTCMinutes (  ) 

Returns:
The minutes of a time according to the Universal Coordinated Time (UTC); in the range [0 - 59].
Example:
        var oDate = new Date( 2005, 7, 15, 12, 30 );
        var nMinute = oDate.getUTCMinutes();
        // nMinute == 30

Number Date::getUTCMonth (  ) 

Returns:
A number that represents a month according to the Universal Coordinated Time (UTC); in the range [0 - 11], where January = 0.
Example:
        var oDate = new Date( 2005, 7, 15, 12, 30 );
        var nMonth = oDate.getMonth();
        // nMonth == 7

Number Date::getUTCSeconds (  ) 

Returns:
The seconds of a time according to the Universal Coordinated Time (UTC); in the range [0 - 59].
Example:
        var oDate = new Date( 2005, 7, 15, 12, 30 );
        var nSecond = oDate.getUTCSeconds();
        // nSecond == 30

Number Date::getYear (  ) 

Returns:
The year as a two, three or four digit number. For years between 1900 and 1999 the return value will be two digits. For years before 1900 the return value will be less than zero; i.e. 1800 == -100. For years greater than or equal to 2000 a value of 100 or greater is returned.
Example:
        var oDate = new Date( 2005, 7, 15, 12, 30 );
        var nYear = oDate.getYear();
        // nYear == 105

void Date::setDate ( Number  dayOfTheMonth  ) 

Sets the day of the month for the Date object.

Parameters:
dayOfTheMonth The day of the month in the range of [1 - 31]
Example:
        var oDate = new Date( 2005, 7, 15, 12, 30 );
        var sDate = oDate.toString();
        // sDate == "Mon Aug 15 12:30:00 2005 GMT-0700"
        oDate.setDate( 18 );
        sDate = oDate.toString();
        // sDate == "Thu Aug 18 12:30:00 2005 GMT-0700"

void Date::setFullYear ( Number  year[,...]  ) 

Sets the year for the Date object. Optionally sets the month and date.

Parameters:
year The four digit year to set.
Example:
        var oDate = new Date( 2005, 7, 15, 12, 30 );
        var sDate = oDate.toString();
        // sDate == "Mon Aug 15 12:30:00 2005 GMT-0700"
        oDate.setFullYear( 2003 );
        sDate = oDate.toString();
        // sDate == "Fri Aug 15 12:30:00 2003 GMT-0700"

void Date::setHours ( Number  hours[,...]  ) 

Sets the hours for the Date object. Optionally sets the minutes, seconds and milliseconds.

Parameters:
hours The hour of the day to set; in the range [0 - 23].
Example:
        var oDate = new Date( 2005, 7, 15, 12, 30 );
        var sDate = oDate.toString();
        // sDate == "Mon Aug 15 12:30:00 2005 GMT-0700"
        oDate.setHours( 10 );
        sDate = oDate.toString();
        // sDate == "Mon Aug 15 10:30:00 2005 GMT-0700"

void Date::setMilliseconds ( Number  milliseconds  ) 

Sets the milliseconds for the Date object.

Parameters:
milliseconds The milliseconds to set; in the range [0 - 999];
Example:
        var oDate = new Date( 2005, 7, 15, 12, 30 );
        var sDate = oDate.toString();
        // sDate == "Mon Aug 15 12:30:00 2005 GMT-0700"
        oDate.setMilliseconds( 10 );
        sDate = oDate.toString();
        // sDate == "Mon Aug 15 12:30:00 2005 GMT-0700"

void Date::setMinutes ( Number  minutes[,...]  ) 

Sets the minutes for the Date object. Optionally sets the seconds and milliseconds.

Parameters:
minutes The minutes to set; in the range [0 - 59].
Example:
        var oDate = new Date( 2005, 7, 15, 12, 30 );
        var sDate = oDate.toString();
        // sDate == "Mon Aug 15 12:30:00 2005 GMT-0700"
        oDate.setMinutes( 10 );
        sDate = oDate.toString();
        // sDate == "Mon Aug 15 12:10:00 2005 GMT-0700"

void Date::setMonth ( Number  month[,...]  ) 

Sets the month of the year for the Date object. Optionally sets the date.

Parameters:
month The month of the year, which must be in the range [0,11], in local time.
Example:
        var oDate = new Date( 2005, 7, 15, 12, 30 );
        var sDate = oDate.toString();
        // sDate == "2005-07-15T12:30:00"
        oDate.setMonth( 9 );
        sDate = oDate.toString();
        // sDate == "2005-09-15T12:30:20"

void Date::setSeconds ( Number  seconds[,...]  ) 

Sets the seconds for the Date object. Optionally sets the milliseconds.

Parameters:
seconds The seconds to set; in the range [0 - 59].
Example:
        var oDate = new Date( 2005, 7, 15, 12, 30 );
        var sDate = oDate.toString();
        // sDate == "Mon Aug 15 12:30:00 2005 GMT-0700"
        oDate.setSeconds( 20 );
        sDate = oDate.toString();
        // sDate == "Mon Aug 15 12:30:20 2005 GMT-0700"

void Date::setTime ( Number  milliseconds  ) 

Sets the date and time, according to the local date and time.

Parameters:
milliseconds The number of milliseconds since midnight on January 1, 1970.
Example:
        var oDate = new Date();
        oDate.setTime( 1124134200000 );
        var sDate = oDate.toString();
        // sDate == "Mon Aug 15 12:30:00 2005 GMT-0700"

void Date::setYear ( Number  year[,...]  ) 

Sets the year for the Date object.

Parameters:
year The year to set. If year is a two digit number, like 91, it will be perceived as 1991. To set a year before 1900 or after 1999 use four digits.
Example:
        var oDate = new Date( 2005, 7, 15, 12, 30 );
        var sDate = oDate.toString();
        // sDate == "Mon Aug 15 12:30:00 2005 GMT-0700"
        oDate.setYear( 2003 );
        sDate = oDate.toString();
        // sDate == "Fri Aug 15 12:30:00 2003 GMT-0700"

String Date::toDateString (  ) 

Returns:
A String repesentation of the date.
Example:
        var oDate = new Date( 2005, 7, 15, 12, 30 );
        var sDate = oDate.toDateString();
        // sDate == "Mon Aug 15 2005"

String Date::toGMTString (  ) 

Returns:
A String repesentation of the Date object, according to the Greenwich Mean Time (GMT).
Example:
        var oDate = new Date( 2005, 7, 15, 12, 30 );
        var sDate = oDate.toGMTString();
        // sDate == "Mon Aug 15 19:30:00 2005 GMT"

String Date::toLocaleDateString (  ) 

Returns:
A String repesentation of the date, according to local time.
Example:
        var oDate = new Date( 2005, 7, 15, 12, 30 );
        var sDate = oDate.toLocaleDateString();
        // sDate == "8/15/2005"

String Date::toLocaleString (  ) 

Returns:
A String repesentation of the Date object, according to local time.
Example:
        var oDate = new Date( 2005, 7, 15, 12, 30 );
        var sDate = oDate.toLocaleString();
        // sDate == "8/15/2005 12:30:00 PM"

Reimplemented from Object.

String Date::toLocaleTimeString (  ) 

Returns:
A String repesentation of the time, according to local time.
Example:
        var oDate = new Date( 2005, 7, 15, 12, 30 );
        var sDate = oDate.toLocaleTimeString();
        // sDate == "12:30:00 PM"

String Date::toString (  ) 

Returns:
A String repesentation of the Date object.
Example:
        var oDate = new Date( 2005, 7, 15, 12, 30 );
        var sDate = oDate.toString();
        // sDate == "Mon Aug 15 12:30:00 2005 GMT-0700"

Reimplemented from Object.

String Date::toTimeString (  ) 

Returns:
A String repesentation of the time.
Example:
        var oDate = new Date( 2005, 7, 15, 12, 30 );
        var sDate = oDate.toTimeString();
        // sDate == "12:30:00"

String Date::toUTCString (  ) 

Returns:
A String repesentation of the Date object, according to the Universal Coordinated Time (UTC).
Example:
        var oDate = new Date( 2005, 7, 15, 12, 30 );
        var sDate = oDate.toUTCString();
        // sDate == "Mon Aug 15 19:30:00 2005 GMT"

Number Date::valueOf (  ) 

Returns:
The primitive value of a Date object.
Example:
        var oDate = new Date( 2005, 7, 15, 12, 30 );
        var nValue = oDate.valueOf();
        // nValue == 1124134200000

Reimplemented from Object.


Generated on Thu Sep 24 12:21:10 2009

Copyright © 2002 - 2009 DAZ 3D, Inc.