/** * Returns the hour of the day corresponding to this <tt>Date</tt>'s time * value, in UTC. * * @return the hour of the day corresponding to this <tt>Date</tt>'s time value, in UTC. */ public double getUTCHours() { return getUTC(false).get(Calendar.HOUR_OF_DAY); }
/** * Constructs a new <tt>Date</tt> object, setting it to the specified time * value. If the specified time value (see class documentation) is greater * than the maximum time value, it is instead set to <tt>NaN</tt>. * * @param milliseconds the time value to set this date to */ public Date(double milliseconds) { if(!Double.isNaN(milliseconds) && !Double.isInfinite(milliseconds) && milliseconds <= 8640000000000000d && milliseconds >= -8640000000000000d) { getUTC(true).setTimeInMillis((long)milliseconds); } }
/** * Returns the month number corresponding to this <tt>Date</tt>'s time value, * in UTC. Month numbers are 0 indexed, with January being 0 and December * being 11. * * @return Returns the month number in which this <tt>Date</tt> is placed, in UTC */ public double getUTCMonth() { return getField(getUTC(false), Calendar.MONTH); }
/** * Returns the seconds of the minute corresponding to this <tt>Date</tt>'s time * value, in UTC. * * @return the seconds of the minute corresponding to this <tt>Date</tt>'s time value, in UTC. */ public double getUTCSeconds() { return getField(getUTC(false), Calendar.SECOND); }
/** * Sets the day of month field of this <tt>Date</tt> interpreted in UTC. * * @param n the new day of month */ public void setUTCDate(int n) { setField(getUTC(true), Calendar.DAY_OF_MONTH, n); }
/** * Returns a <tt>String</tt> representation of this <tt>Date</tt>. * The contents of the <tt>String</tt> are implementation-dependent, but * are intended to represent the <tt>Date</tt> in UTC in * a convenient, human-readable form. * * <strong>NOTE:</strong> For any Date value <tt>d</tt> whose milliseconds * amount is zero, the result of <tt>Date.parse(d.toString())</tt> is equal * to <tt>d.valueOf()</tt>. See 15.9.4.2. * * @return a human readable version of this <tt>Date</tt> in UTC */ public String toUTCString() { if (getUTC(false) != null) { return DateFormat.getDateTimeInstance(DateFormat.FULL, DateFormat.FULL, Locale.US).format(utc.getTime()); } return null; }
/** * Returns the year corresponding to this <tt>Date</tt>'s time value, in UTC. * * @return the year corresponding to this <tt>Date</tt>'s time value, in UTC. */ public double getUTCFullYear() { return getField(getUTC(false), Calendar.YEAR); }
/** * Returns the milliseconds of the second corresponding to this <tt>Date</tt>'s time * value, in UTC. * * @return the milliseconds of the second corresponding to this <tt>Date</tt>'s time value, in UTC. */ public double getUTCMilliseconds() { return getField(getUTC(false), Calendar.MILLISECOND); }
/** * Sets the milliseconds field of this <tt>Date</tt> interpreted in UTC. * * @param ms the new milliseconds */ public void setUTCMilliseconds(int ms) { setField(getUTC(true), Calendar.MILLISECOND, ms); }
/** * Sets the year field of this date in UTC. If <tt>0 <= year <= 99</tt>, * then the year is actually set to <tt>1900 + year</tt>, otherwise it is * directly set to the specified year. * * @deprecated use <tt>setFullYear</tt> or <tt>setUTCFullYear()</tt> instead * @param year */ @Deprecated() public void setYear(int year) { if(year >= 0 && year <= 99){ year += 1900; } setField(getUTC(true), Calendar.YEAR, year); }
/** * Returns the day of the month corresponding to this <tt>Date</tt>'s time value, * in UTC. * * @return the day of the month corresponding to this <tt>Date</tt>'s time value, in UTC. */ public double getUTCDate() { return getField(getUTC(false), Calendar.DAY_OF_MONTH); }
/** * Returns the day of the week corresponding to this <tt>Date</tt>'s time * value, in UTC. A weekday value of 0 specifies Sunday; 1 * specifies Monday; 2 specifies Tuesday; 3 specifies Wednesday; 4 * specifies Thursday; 5 specifies Friday; and 6 specifies Saturday * * @return the day of the week corresponding to this <tt>Date</tt>'s time value, in UTC. */ public double getUTCDay() { return getField(getUTC(false), Calendar.DAY_OF_WEEK); }
/** * Returns the minutes of the hour corresponding to this <tt>Date</tt>'s time * value, in UTC. * * @return the minutes of the hour corresponding to this <tt>Date</tt>'s time value, in UTC. */ public double getUTCMinutes() { return getField(getUTC(false), Calendar.MINUTE); }
/** * Sets the seconds and milliseconds fields of this <tt>Date</tt> * interpreted in UTC. * * @param sec the new seconds * @param ms the new milliseconds */ public void setUTCSeconds(int sec, int ms) { setField(getUTC(true), Calendar.SECOND, sec); setUTCMilliseconds(ms); }
/** * Sets the minutes, seconds and milliseconds field of this <tt>Date</tt> * interpreted in UTC. * * @param min the new minutes * @param sec the new seconds * @param ms the new milliseconds */ public void setUTCMinutes(int min, int sec, int ms) { setField(getUTC(true), Calendar.MINUTE, min); setUTCSeconds(sec, ms); }
/** * Sets the hours, minutes, seconds and milliseconds field of this * <tt>Date</tt> interpreted in UTC. * * @param hour the new hour * @param min the new minutes * @param sec the new seconds * @param ms the new milliseconds */ public void setUTCHours(int hour, int min, int sec, int ms) { setField(getUTC(true), Calendar.HOUR_OF_DAY, hour); setUTCMinutes(min, sec, ms); }
/** * Sets the month of year and day of month fields of this <tt>Date</tt> * interpreted in UTC. Month numbers are 0 indexed, with * January being 0 and December being 11. * * @param month the new month * @param day the new day of month */ public void setUTCMonth(int month, int day) { setField(getUTC(true), Calendar.MONTH, month); setUTCDate(day); }
/** * Sets the year, month and day of month fields of this <tt>Date</tt> * interpreted in UTC. * * @param year the new year * @param month the new month * @param day the new day of month */ public void setUTCFullYear(int year, int month, int day) { setField(getUTC(true), Calendar.YEAR, year); setUTCMonth(month, day); }