Date represents a specific instant in time, with millisecond precision.
More...
#include <java_util_Date.h>
Inheritance diagram for java::util::Date:


Public Types | |
| enum | { xmogDefaultFlags = xmog_base::GLOBAL, xmogMajorVersion = 3, xmogMinorVersion = 2, xmogPatchVersion = 9, xmogBuildNumber = 2047 } |
|
typedef ::xmog_java_array_template< ::java::util::Date > | array1D |
|
typedef ::xmog_java_array_template< ::xmog_java_array_template< ::java::util::Date > > | array2D |
Public Member Functions | |
| virtual bool | after (const ::java::util::Date &when,::xmog_localenv *p_xenv=NULL, xmog_flags f_xflags=xmogDefaultFlags) |
| Tests if this date is after the specified date. | |
| virtual bool | before (const ::java::util::Date &when,::xmog_localenv *p_xenv=NULL, xmog_flags f_xflags=xmogDefaultFlags) |
| Tests if this date is before the specified date. | |
| virtual ::java::lang::Object | clone (::xmog_localenv *p_xenv=NULL, xmog_flags f_xflags=xmogDefaultFlags) |
| Return a copy of this object. | |
| virtual jint | compareTo (const ::java::util::Date &anotherDate,::xmog_localenv *p_xenv=NULL, xmog_flags f_xflags=xmogDefaultFlags) |
| Compares two Dates for ordering. | |
| virtual jint | compareTo (const ::java::lang::Object &o,::xmog_localenv *p_xenv=NULL, xmog_flags f_xflags=xmogDefaultFlags) |
| Compares this Date to another Object. | |
| Date (jint year, jint month, jint date, jint hrs, jint _min, jint sec,::xmog_localenv *p_xenv=NULL, xmog_flags f_xflags=xmogDefaultFlags) | |
Allocates a Date object and initializes it so that it represents the instant at the start of the second specified by the year, month, date, hrs, min, and sec arguments, in the local time zone. | |
| Date (jint year, jint month, jint date, jint hrs, jint _min,::xmog_localenv *p_xenv=NULL, xmog_flags f_xflags=xmogDefaultFlags) | |
Allocates a Date object and initializes it so that it represents the instant at the start of the minute specified by the year, month, date, hrs, and min arguments, in the local time zone. | |
| Date (jint year, jint month, jint date,::xmog_localenv *p_xenv=NULL, xmog_flags f_xflags=xmogDefaultFlags) | |
Allocates a Date object and initializes it so that it represents midnight, local time, at the beginning of the day specified by the year, month, and date arguments. | |
| Date (::xmog_dummy _use_java_ctor,::xmog_localenv *p_xenv=NULL, xmog_flags f_xflags=xmogDefaultFlags) | |
Allocates a Date object and initializes it so that it represents the time at which it was allocated, measured to the nearest millisecond. | |
| Date (const ::java::lang::String &s,::xmog_localenv *p_xenv=NULL, xmog_flags f_xflags=xmogDefaultFlags) | |
Allocates a Date object and initializes it so that it represents the date and time indicated by the string s, which is interpreted as if by the method. | |
| Date (jlong date,::xmog_localenv *p_xenv=NULL, xmog_flags f_xflags=xmogDefaultFlags) | |
Allocates a Date object and initializes it to represent the specified number of milliseconds since the standard base time known as "the epoch", namely January 1, 1970, 00:00:00 GMT. | |
| virtual bool | equals (const ::java::lang::Object &obj,::xmog_localenv *p_xenv=NULL, xmog_flags f_xflags=xmogDefaultFlags) |
| Compares two dates for equality. | |
| virtual jint | getDate (::xmog_localenv *p_xenv=NULL, xmog_flags f_xflags=xmogDefaultFlags) |
Returns the day of the month represented by this Date object. | |
| virtual jint | getDay (::xmog_localenv *p_xenv=NULL, xmog_flags f_xflags=xmogDefaultFlags) |
| Returns the day of the week represented by this date. | |
| virtual jint | getHours (::xmog_localenv *p_xenv=NULL, xmog_flags f_xflags=xmogDefaultFlags) |
Returns the hour represented by this Date object. | |
| virtual jint | getMinutes (::xmog_localenv *p_xenv=NULL, xmog_flags f_xflags=xmogDefaultFlags) |
| Returns the number of minutes past the hour represented by this date, as interpreted in the local time zone. | |
| virtual jint | getMonth (::xmog_localenv *p_xenv=NULL, xmog_flags f_xflags=xmogDefaultFlags) |
Returns a number representing the month that contains or begins with the instant in time represented by this Date object. | |
| virtual jint | getSeconds (::xmog_localenv *p_xenv=NULL, xmog_flags f_xflags=xmogDefaultFlags) |
| Returns the number of seconds past the minute represented by this date. | |
| virtual jlong | getTime (::xmog_localenv *p_xenv=NULL, xmog_flags f_xflags=xmogDefaultFlags) |
Returns the number of milliseconds since January 1, 1970, 00:00:00 GMT represented by this Date object. | |
| virtual jint | getTimezoneOffset (::xmog_localenv *p_xenv=NULL, xmog_flags f_xflags=xmogDefaultFlags) |
Returns the offset, measured in minutes, for the local time zone relative to UTC that is appropriate for the time represented by this Date object. | |
| virtual jint | getYear (::xmog_localenv *p_xenv=NULL, xmog_flags f_xflags=xmogDefaultFlags) |
Returns a value that is the result of subtracting 1900 from the year that contains or begins with the instant in time represented by this Date object, as interpreted in the local time zone. | |
| virtual void | setDate (jint date,::xmog_localenv *p_xenv=NULL, xmog_flags f_xflags=xmogDefaultFlags) |
Sets the day of the month of this Date object to the specified value. | |
| virtual void | setHours (jint hours,::xmog_localenv *p_xenv=NULL, xmog_flags f_xflags=xmogDefaultFlags) |
Sets the hour of this Date object to the specified value. | |
| virtual void | setMinutes (jint minutes,::xmog_localenv *p_xenv=NULL, xmog_flags f_xflags=xmogDefaultFlags) |
Sets the minutes of this Date object to the specified value. | |
| virtual void | setMonth (jint month,::xmog_localenv *p_xenv=NULL, xmog_flags f_xflags=xmogDefaultFlags) |
| Sets the month of this date to the specified value. | |
| virtual void | setSeconds (jint seconds,::xmog_localenv *p_xenv=NULL, xmog_flags f_xflags=xmogDefaultFlags) |
Sets the seconds of this Date to the specified value. | |
| virtual void | setTime (jlong time,::xmog_localenv *p_xenv=NULL, xmog_flags f_xflags=xmogDefaultFlags) |
Sets this Date object to represent a point in time that is time milliseconds after January 1, 1970 00:00:00 GMT. | |
| virtual void | setYear (jint year,::xmog_localenv *p_xenv=NULL, xmog_flags f_xflags=xmogDefaultFlags) |
Sets the year of this Date object to be the specified value plus 1900. | |
Static Public Member Functions | |
| static jlong | parse (const ::java::lang::String &s,::xmog_localenv *p_xenv=NULL, xmog_flags f_xflags=xmogDefaultFlags) |
| Returns a hash code value for this object. | |
| static jlong | UTC (jint year, jint month, jint date, jint hrs, jint _min, jint sec,::xmog_localenv *p_xenv=NULL, xmog_flags f_xflags=xmogDefaultFlags) |
| Determines the date and time based on the arguments. | |
Date represents a specific instant in time, with millisecond precision.
Prior to JDK 1.1, the class Date had two additional functions. It allowed the interpretation of dates as year, month, day, hour, minute, and second values. It also allowed the formatting and parsing of date strings. Unfortunately, the API for these functions was not amenable to internationalization. As of JDK 1.1, the Calendar class should be used to convert between dates and time fields and the DateFormat class should be used to format and parse date strings. The corresponding methods in Date are deprecated.
Although the Date class is intended to reflect coordinated universal time (UTC), it may not do so exactly, depending on the host environment of the Java Virtual Machine. Nearly all modern operating systems assume that 1 day = 24 60 60 = 86400 seconds in all cases. In UTC, however, about once every year or two there is an extra second, called a "leap second." The leap second is always added as the last second of the day, and always on December 31 or June 30. For example, the last minute of the year 1995 was 61 seconds long, thanks to an added leap second. Most computer clocks are not accurate enough to be able to reflect the leap-second distinction.
Some computer standards are defined in terms of Greenwich mean time (GMT), which is equivalent to universal time (UT). GMT is the "civil" name for the standard; UT is the "scientific" name for the same standard. The distinction between UTC and UT is that UTC is based on an atomic clock and UT is based on astronomical observations, which for all practical purposes is an invisibly fine hair to split. Because the earth's rotation is not uniform (it slows down and speeds up in complicated ways), UT does not always flow uniformly. Leap seconds are introduced as needed into UTC so as to keep UTC within 0.9 seconds of UT1, which is a version of UT with certain corrections applied. There are other time and date systems as well; for example, the time scale used by the satellite-based global positioning system (GPS) is synchronized to UTC but is not adjusted for leap seconds. An interesting source of further information is the U.S. Naval Observatory, particularly the Directorate of Time at: <blockquote>
<a href=http://tycho.usno.navy.mil>http://tycho.usno.navy.mil</a>
</blockquote>
and their definitions of "Systems of Time" at: <blockquote>
<a href=http://tycho.usno.navy.mil/systime.html>http://tycho.usno.navy.mil/systime.html</a>
</blockquote>
In all methods of class Date that accept or return year, month, date, hours, minutes, and seconds values, the following representations are used:
- 1900. In all cases, arguments given to methods for these purposes need not fall within the indicated ranges; for example, a date may be specified as January 32 and is interpreted as meaning February 1.
Arthur van Hoff
Alan Liu
|
||||||||||||||||
|
Allocates a
|
|
||||||||||||||||
|
Allocates a
|
|
||||||||||||||||
|
Allocates a
|
|
||||||||||||||||||||||||
|
Allocates a
|
|
||||||||||||||||||||||||||||||||
|
Allocates a
|
|
||||||||||||||||||||||||||||||||||||
|
Allocates a
|
|
||||||||||||||||
|
Tests if this date is after the specified date.
|
|
||||||||||||||||
|
Tests if this date is before the specified date.
|
|
||||||||||||
|
Return a copy of this object.
|
|
||||||||||||||||
|
Compares two Dates for ordering.
|
|
||||||||||||||||
|
Compares this Date to another Object.
If the Object is a Date, this function behaves like
Reimplemented from java::lang::Comparable. |
|
||||||||||||||||
|
Compares two dates for equality.
The result is
Thus, two
Reimplemented from java::lang::Object. |
|
||||||||||||
|
Returns the day of the month represented by this
The value returned is between
|
|
||||||||||||
|
Returns the day of the week represented by this date.
The returned value (
|
|
||||||||||||
|
Returns the hour represented by this
The returned value is a number (
|
|
||||||||||||
|
Returns the number of minutes past the hour represented by this date, as interpreted in the local time zone.
The value returned is between
|
|
||||||||||||
|
Returns a number representing the month that contains or begins with the instant in time represented by this
The value returned is between
|
|
||||||||||||
|
Returns the number of seconds past the minute represented by this date.
The value returned is between
|
|
||||||||||||
|
Returns the number of milliseconds since January 1, 1970, 00:00:00 GMT represented by this
|
|
||||||||||||
|
Returns the offset, measured in minutes, for the local time zone relative to UTC that is appropriate for the time represented by this For example, in Massachusetts, five time zones west of Greenwich: <blockquote>
new Date(96, 1, 14).getTimezoneOffset() returns 300 </blockquote> because on February 14, 1996, standard time (Eastern Standard Time) is in use, which is offset five hours from UTC; but: <blockquote>
new Date(96, 5, 1).getTimezoneOffset() returns 240 </blockquote> because on June 1, 1996, daylight saving time (Eastern Daylight Time) is in use, which is offset only four hours from UTC. This method produces the same result as if it computed: <blockquote>
(this.getTime() - UTC(this.getYear(), this.getMonth(), this.getDate(), this.getHours(), this.getMinutes(), this.getSeconds())) / (60 * 1000) </blockquote>
|
|
||||||||||||
|
Returns a value that is the result of subtracting 1900 from the year that contains or begins with the instant in time represented by this
|
|
||||||||||||||||
|
Returns a hash code value for this object.
The result is the exclusive OR of the two halves of the primitive
(int)(this.getTime()^(this.getTime() >>> 32)) </blockquote>
/** Attempts to interpret the string
If the attempt is successful, the time indicated is returned represented as the distance, measured in milliseconds, of that time from the epoch (00:00:00 GMT on January 1, 1970). If the attempt fails, an It accepts many syntaxes; in particular, it recognizes the IETF standard date syntax: "Sat, 12 Aug 1995 13:30:00 GMT". It also understands the continental U.S. time-zone abbreviations, but for general use, a time-zone offset should be used: "Sat, 12 Aug 1995 13:30:00 GMT+0430" (4 hours, 30 minutes west of the Greenwich meridian). If no time zone is specified, the local time zone is assumed. GMT and UTC are considered equivalent.
The string
abcdefghijklmnopqrstuvwxyz
ABCDEFGHIJKLMNOPQRSTUVWXYZ
0123456789,+-:/
</blockquote> and whitespace characters. A consecutive sequence of decimal digits is treated as a decimal number:
A consecutive sequence of letters is regarded as a word and treated as follows:
Once the entire string s has been scanned, it is converted to a time result in one of two ways. If a time zone or time-zone offset has been recognized, then the year, month, day of month, hour, minute, and second are interpreted in UTC and then the time-zone offset is applied. Otherwise, the year, month, day of month, hour, minute, and second are interpreted in the local time zone.
|
|
||||||||||||||||
|
Sets the day of the month of this
This
|
|
||||||||||||||||
|
Sets the hour of this
This
|
|
||||||||||||||||
|
Sets the minutes of this
This
|
|
||||||||||||||||
|
Sets the month of this date to the specified value.
This
|
|
||||||||||||||||
|
Sets the seconds of this
This
|
|
||||||||||||||||
|
Sets this
|
|
||||||||||||||||
|
Sets the year of this
This
|
|
||||||||||||||||||||||||||||||||||||
|
Determines the date and time based on the arguments.
The arguments are interpreted as a year, month, day of the month, hour of the day, minute within the hour, and second within the minute, exactly as for the
|
1.4.1