hour -= zoneOffset; return UTC(year - 1900, month, date, hour, minute, second);
public static long UTC(int year, int month, int date, int hrs, int min, int sec) { return java.util.Date.UTC(year, month, date, hrs, min, sec); } }
//date.setTimeZone(TimeZone.getTimeZone("UTC")); date.set(Calendar.HOUR_OF_DAY, 0); Date utcDate = date.getTime(); utcDate.UTC(2014, 9, 1, 26, 1, 0); System.out.println(utcDate.toGMTString() + " " + date.getTimeInMillis());
/** * Returns a number representing the Timestamp's point in time that is * the number of milliseconds (<em>ignoring</em> any fractional milliseconds) * from the epoch. * <p> * This method will return the same result for all Timestamps representing * the same point in time, regardless of the local offset. * * @return * number of milliseconds (<em>ignoring</em> any fractional * milliseconds) from the epoch (1970-01-01T00:00:00.000Z) */ @SuppressWarnings("deprecation") public long getMillis() { // month is 0 based for Date long millis = Date.UTC(this._year - 1900, this._month - 1, this._day, this._hour, this._minute, this._second); if (this._fraction != null) { int frac = this._fraction.movePointRight(3).intValue(); millis += frac; } return millis; }
/** * Returns a number representing the Timestamp's point in time that is * the number of milliseconds (<em>ignoring</em> any fractional milliseconds) * from the epoch. * <p> * This method will return the same result for all Timestamps representing * the same point in time, regardless of the local offset. * * @return * number of milliseconds (<em>ignoring</em> any fractional * milliseconds) from the epoch (1970-01-01T00:00:00.000Z) */ @SuppressWarnings("deprecation") public long getMillis() { // month is 0 based for Date long millis = Date.UTC(this._year - 1900, this._month - 1, this._day, this._hour, this._minute, this._second); if (this._fraction != null) { int frac = this._fraction.movePointRight(3).intValue(); millis += frac; } return millis; }
@SuppressWarnings("deprecation") public static long getUTCTime( int year, int month, int day, int hour, int minute, int second, int milli ) { return Date.UTC( year - 1900, month - 1, day, hour, minute, second ) + milli; }
case MINUTE: case SECOND: millis = Date.UTC(this._year - 1900, this._month - 1, this._day, this._hour, this._minute, this._second); dec = BigDecimal.valueOf(millis); if (_fraction != null) {
case MINUTE: case SECOND: millis = Date.UTC(this._year - 1900, this._month - 1, this._day, this._hour, this._minute, this._second); dec = BigDecimal.valueOf(millis); if (_fraction != null) {
@SuppressWarnings("deprecation") public static long UTC(int year, int month, int date, int hrs, int min, int sec) { Capturer.capture(Instrumenter.CAPTURE_ID_JAVA_UTIL_DATE, CaptureUtil.loadClass("java/util/Date"), "UTC", "(IIIIII)J", new Object[] {year, month, date, hrs, min, sec}); long ret = java.util.Date.UTC(year, month, date, hrs, min, sec); Capturer.enable(Instrumenter.CAPTURE_ID_JAVA_UTIL_DATE, CaptureUtil.loadClass("java/util/Date"), ret); return ret; }
hour -= zoneOffset; return UTC(year - 1900, month, date, hour, minute, second);
hour -= zoneOffset; return UTC(year - 1900, month, date, hour, minute, second);
hour -= zoneOffset; return UTC(year - 1900, month, date, hour, minute, second);
hour -= zoneOffset; return UTC(year - 1900, month, date, hour, minute, second);
hour -= zoneOffset; return UTC(year - 1900, month, date, hour, minute, second);
hour -= zoneOffset; return UTC(year - 1900, month, date, hour, minute, second);
y = parseInt(buf, ps) - 1900; return Date.UTC(y, m, d, hh, mm, ss);