public class

JsDate

extends JavaScriptObject
java.lang.Object
   ↳ com.google.gwt.core.client.JavaScriptObject
     ↳ com.google.gwt.core.client.JsDate

Class Overview

A simple wrapper around a native JS Date object.

Summary

Protected Constructors
JsDate()
Non directly instantiable, use one of the create() methods.
Public Methods
static double UTC(int year, int month, int dayOfMonth, int hours, int minutes, int seconds, int millis)
Returns the internal millisecond representation of the specified UTC date and time.
static JsDate create(int year, int month, int dayOfMonth, int hours)
Creates a new date using the specified values.
static JsDate create()
Creates a new date with the current time.
static JsDate create(int year, int month)
Creates a new date using the specified values.
static JsDate create(int year, int month, int dayOfMonth, int hours, int minutes)
Creates a new date using the specified values.
static JsDate create(int year, int month, int dayOfMonth)
Creates a new date using the specified values.
static JsDate create(double milliseconds)
Creates a new date with the specified internal representation, which is the number of milliseconds since midnight on January 1st, 1970.
static JsDate create(int year, int month, int dayOfMonth, int hours, int minutes, int seconds)
Creates a new date using the specified values.
static JsDate create(int year, int month, int dayOfMonth, int hours, int minutes, int seconds, int millis)
Creates a new date using the specified values.
static JsDate create(String dateString)
Creates a new date from a string to be parsed.
final int getDate()
Returns the day of the month.
final int getDay()
Returns the day of the week, from 0 (Sunday) to 6 Saturday.
final int getFullYear()
Returns the four-digit year.
final int getHours()
Returns the hour, between 0 (midnight) and 23.
final int getMilliseconds()
Returns the milliseconds, between 0 and 999.
final int getMinutes()
Returns the minutes, between 0 and 59.
final int getMonth()
Returns the month, from 0 (January) to 6 December.
final int getSeconds()
Returns the seconds, between 0 and 59.
final double getTime()
Returns the internal millisecond representation of the date, the number of milliseconds since midnight on January 1st, 1970.
final int getTimezoneOffset()
Returns the difference, in minutes, between the local and UTC representations of this date.
final int getUTCDate()
Returns the day of the month, in UTC.
final int getUTCDay()
Returns the day of the week, from 0 (Sunday) to 6 Saturday, in UTC.
final int getUTCFullYear()
Returns the four-digit year, in UTC.
final int getUTCHours()
Returns the hour, between 0 (midnight) and 23, in UTC.
final int getUTCMilliseconds()
Returns the milliseconds, between 0 and 999, in UTC.
final int getUTCMinutes()
Returns the minutes, between 0 and 59, in UTC.
final int getUTCMonth()
Returns the month, from 0 (January) to 6 December, in UTC.
final int getUTCSeconds()
Returns the seconds, between 0 and 59, in UTC.
final int getYear()
This method is deprecated. Use getFullYear().
static double parse(String dateString)
Parses a string representation of a date and time and returns the internal millisecond representation.
final double setDate(int dayOfMonth)
Sets the day of the month.
final double setFullYear(int year)
Sets the year.
final double setFullYear(int year, int month, int day)
Sets the year, month, and day.
final double setFullYear(int year, int month)
Sets the year and month.
final double setHours(int hours, int mins)
Sets the hour and minutes.
final double setHours(int hours, int mins, int secs)
Sets the hour, minutes, and seconds.
final double setHours(int hours)
Sets the hour.
final double setHours(int hours, int mins, int secs, int ms)
Sets the hour, minutes, seconds, and milliseconds.
final double setMinutes(int minutes, int seconds, int millis)
Sets the minutes, seconds, and milliseconds.
final double setMinutes(int minutes)
Sets the minutes.
final double setMinutes(int minutes, int seconds)
Sets the minutes and seconds.
final double setMonth(int month)
Sets the month.
final double setMonth(int month, int dayOfMonth)
Sets the month and day.
final double setSeconds(int seconds, int millis)
Sets the seconds and milliseconds.
final double setSeconds(int seconds)
Sets the seconds.
final double setTime(double milliseconds)
Sets the internal date representation.
final double setUTCDate(int dayOfMonth)
Sets the day of the month, in UTC.
final double setUTCFullYear(int year)
Sets the year, in UTC.
final double setUTCFullYear(int year, int month)
Sets the year and month, in UTC.
final double setUTCFullYear(int year, int month, int day)
Sets the year, month, and day, in UTC.
final double setUTCHours(int hours)
Sets the hour, in UTC.
final double setUTCHours(int hours, int mins)
Sets the hour and minutes, in UTC.
final double setUTCHours(int hours, int mins, int secs)
Sets the hour, minutes, and seconds, in UTC.
final double setUTCHours(int hours, int mins, int secs, int ms)
Sets the hour, minutes, seconds, and milliseconds, in UTC.
final double setUTCMinutes(int minutes)
Sets the minutes, in UTC.
final double setUTCMinutes(int minutes, int seconds, int millis)
Sets the minutes, seconds, and milliseconds, in UTC.
final double setUTCMinutes(int minutes, int seconds)
Sets the minutes and seconds, in UTC.
final double setUTCMonth(int month)
Sets the month, in UTC.
final double setUTCMonth(int month, int dayOfMonth)
Sets the month and day, in UTC.
final double setUTCSeconds(int seconds, int millis)
Sets the seconds and milliseconds, in UTC.
final double setUTCSeconds(int seconds)
Sets the seconds, in UTC.
final double setYear(int year)
This method is deprecated. Use setFullYear(int).
final String toDateString()
Returns a date string in the local time zone.
final String toGMTString()
This method is deprecated. Use toUTCString().
final String toLocaleDateString()
Returns a date string in the local time zone according to local formatting conventions.
final String toLocaleString()
Returns a date and time string in the local time zone according to local formatting conventions.
final String toLocaleTimeString()
Returns a time string in the local time zone according to local formatting conventions.
final String toTimeString()
Returns a time string in the local time zone.
final String toUTCString()
Returns a date and time string in UTC.
final double valueOf()
Returns the millisecond representation, as getTime().
[Expand]
Inherited Methods
From class com.google.gwt.core.client.JavaScriptObject
From class java.lang.Object

Protected Constructors

protected JsDate ()

Non directly instantiable, use one of the create() methods.

Public Methods

public static double UTC (int year, int month, int dayOfMonth, int hours, int minutes, int seconds, int millis)

Returns the internal millisecond representation of the specified UTC date and time.

public static JsDate create (int year, int month, int dayOfMonth, int hours)

Creates a new date using the specified values.

public static JsDate create ()

Creates a new date with the current time.

public static JsDate create (int year, int month)

Creates a new date using the specified values.

public static JsDate create (int year, int month, int dayOfMonth, int hours, int minutes)

Creates a new date using the specified values.

public static JsDate create (int year, int month, int dayOfMonth)

Creates a new date using the specified values.

public static JsDate create (double milliseconds)

Creates a new date with the specified internal representation, which is the number of milliseconds since midnight on January 1st, 1970. This is the same representation returned by getTime().

public static JsDate create (int year, int month, int dayOfMonth, int hours, int minutes, int seconds)

Creates a new date using the specified values.

public static JsDate create (int year, int month, int dayOfMonth, int hours, int minutes, int seconds, int millis)

Creates a new date using the specified values.

public static JsDate create (String dateString)

Creates a new date from a string to be parsed.

public final int getDate ()

Returns the day of the month.

public final int getDay ()

Returns the day of the week, from 0 (Sunday) to 6 Saturday.

public final int getFullYear ()

Returns the four-digit year.

public final int getHours ()

Returns the hour, between 0 (midnight) and 23.

public final int getMilliseconds ()

Returns the milliseconds, between 0 and 999.

public final int getMinutes ()

Returns the minutes, between 0 and 59.

public final int getMonth ()

Returns the month, from 0 (January) to 6 December.

public final int getSeconds ()

Returns the seconds, between 0 and 59.

public final double getTime ()

Returns the internal millisecond representation of the date, the number of milliseconds since midnight on January 1st, 1970. This is the same representation returned by getTime().

public final int getTimezoneOffset ()

Returns the difference, in minutes, between the local and UTC representations of this date. The value returned is affected by whether or not daylight savings time would be in effect on specified date.

public final int getUTCDate ()

Returns the day of the month, in UTC.

public final int getUTCDay ()

Returns the day of the week, from 0 (Sunday) to 6 Saturday, in UTC.

public final int getUTCFullYear ()

Returns the four-digit year, in UTC.

public final int getUTCHours ()

Returns the hour, between 0 (midnight) and 23, in UTC.

public final int getUTCMilliseconds ()

Returns the milliseconds, between 0 and 999, in UTC.

public final int getUTCMinutes ()

Returns the minutes, between 0 and 59, in UTC.

public final int getUTCMonth ()

Returns the month, from 0 (January) to 6 December, in UTC.

public final int getUTCSeconds ()

Returns the seconds, between 0 and 59, in UTC.

public final int getYear ()

This method is deprecated.
Use getFullYear().

Returns the year minus 1900.

public static double parse (String dateString)

Parses a string representation of a date and time and returns the internal millisecond representation. If the string cannot be parsed, the returned value will be NaN. Use isNaN(double) to check the result.

public final double setDate (int dayOfMonth)

Sets the day of the month. Returns the millisecond representation of the adjusted date.

public final double setFullYear (int year)

Sets the year. Returns the millisecond representation of the adjusted date.

public final double setFullYear (int year, int month, int day)

Sets the year, month, and day. Returns the millisecond representation of the adjusted date.

public final double setFullYear (int year, int month)

Sets the year and month. Returns the millisecond representation of the adjusted date.

public final double setHours (int hours, int mins)

Sets the hour and minutes. Returns the millisecond representation of the adjusted date.

public final double setHours (int hours, int mins, int secs)

Sets the hour, minutes, and seconds. Returns the millisecond representation of the adjusted date.

public final double setHours (int hours)

Sets the hour. Returns the millisecond representation of the adjusted date.

public final double setHours (int hours, int mins, int secs, int ms)

Sets the hour, minutes, seconds, and milliseconds. Returns the millisecond representation of the adjusted date.

public final double setMinutes (int minutes, int seconds, int millis)

Sets the minutes, seconds, and milliseconds. Returns the millisecond representation of the adjusted date.

public final double setMinutes (int minutes)

Sets the minutes. Returns the millisecond representation of the adjusted date.

public final double setMinutes (int minutes, int seconds)

Sets the minutes and seconds. Returns the millisecond representation of the adjusted date.

public final double setMonth (int month)

Sets the month. Returns the millisecond representation of the adjusted date.

public final double setMonth (int month, int dayOfMonth)

Sets the month and day. Returns the millisecond representation of the adjusted date.

public final double setSeconds (int seconds, int millis)

Sets the seconds and milliseconds. Returns the millisecond representation of the adjusted date.

public final double setSeconds (int seconds)

Sets the seconds. Returns the millisecond representation of the adjusted date.

public final double setTime (double milliseconds)

Sets the internal date representation. Returns the milliseconds argument.

public final double setUTCDate (int dayOfMonth)

Sets the day of the month, in UTC. Returns the millisecond representation of the adjusted date.

public final double setUTCFullYear (int year)

Sets the year, in UTC. Returns the millisecond representation of the adjusted date.

public final double setUTCFullYear (int year, int month)

Sets the year and month, in UTC. Returns the millisecond representation of the adjusted date.

public final double setUTCFullYear (int year, int month, int day)

Sets the year, month, and day, in UTC. Returns the millisecond representation of the adjusted date.

public final double setUTCHours (int hours)

Sets the hour, in UTC. Returns the millisecond representation of the adjusted date.

public final double setUTCHours (int hours, int mins)

Sets the hour and minutes, in UTC. Returns the millisecond representation of the adjusted date.

public final double setUTCHours (int hours, int mins, int secs)

Sets the hour, minutes, and seconds, in UTC. Returns the millisecond representation of the adjusted date.

public final double setUTCHours (int hours, int mins, int secs, int ms)

Sets the hour, minutes, seconds, and milliseconds, in UTC. Returns the millisecond representation of the adjusted date.

public final double setUTCMinutes (int minutes)

Sets the minutes, in UTC. Returns the millisecond representation of the adjusted date.

public final double setUTCMinutes (int minutes, int seconds, int millis)

Sets the minutes, seconds, and milliseconds, in UTC. Returns the millisecond representation of the adjusted date.

public final double setUTCMinutes (int minutes, int seconds)

Sets the minutes and seconds, in UTC. Returns the millisecond representation of the adjusted date.

public final double setUTCMonth (int month)

Sets the month, in UTC. Returns the millisecond representation of the adjusted date.

public final double setUTCMonth (int month, int dayOfMonth)

Sets the month and day, in UTC. Returns the millisecond representation of the adjusted date.

public final double setUTCSeconds (int seconds, int millis)

Sets the seconds and milliseconds, in UTC. Returns the millisecond representation of the adjusted date.

public final double setUTCSeconds (int seconds)

Sets the seconds, in UTC. Returns the millisecond representation of the adjusted date.

public final double setYear (int year)

This method is deprecated.
Use setFullYear(int).

Sets a two-digit year.

public final String toDateString ()

Returns a date string in the local time zone.

public final String toGMTString ()

This method is deprecated.
Use toUTCString().

Returns a date and time string in GMT.

public final String toLocaleDateString ()

Returns a date string in the local time zone according to local formatting conventions.

public final String toLocaleString ()

Returns a date and time string in the local time zone according to local formatting conventions.

public final String toLocaleTimeString ()

Returns a time string in the local time zone according to local formatting conventions.

public final String toTimeString ()

Returns a time string in the local time zone.

public final String toUTCString ()

Returns a date and time string in UTC.

public final double valueOf ()

Returns the millisecond representation, as getTime().