Java Code Examples for sun.util.calendar.BaseCalendar#getCalendarDate()
The following examples show how to use
sun.util.calendar.BaseCalendar#getCalendarDate() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: Date.java From Java8CN with Apache License 2.0 | 5 votes |
private final BaseCalendar.Date getCalendarDate() { if (cdate == null) { BaseCalendar cal = getCalendarSystem(fastTime); cdate = (BaseCalendar.Date) cal.getCalendarDate(fastTime, TimeZone.getDefaultRef()); } return cdate; }
Example 2
Source File: Date.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 5 votes |
private final BaseCalendar.Date getCalendarDate() { if (cdate == null) { BaseCalendar cal = getCalendarSystem(fastTime); cdate = (BaseCalendar.Date) cal.getCalendarDate(fastTime, TimeZone.getDefaultRef()); } return cdate; }
Example 3
Source File: SimpleTimeZone.java From hottub with GNU General Public License v2.0 | 5 votes |
/** * @see TimeZone#getOffsets */ int getOffsets(long date, int[] offsets) { int offset = rawOffset; computeOffset: if (useDaylight) { synchronized (this) { if (cacheStart != 0) { if (date >= cacheStart && date < cacheEnd) { offset += dstSavings; break computeOffset; } } } BaseCalendar cal = date >= GregorianCalendar.DEFAULT_GREGORIAN_CUTOVER ? gcal : (BaseCalendar) CalendarSystem.forName("julian"); BaseCalendar.Date cdate = (BaseCalendar.Date) cal.newCalendarDate(TimeZone.NO_TIMEZONE); // Get the year in local time cal.getCalendarDate(date + rawOffset, cdate); int year = cdate.getNormalizedYear(); if (year >= startYear) { // Clear time elements for the transition calculations cdate.setTimeOfDay(0, 0, 0, 0); offset = getOffset(cal, cdate, year, date); } } if (offsets != null) { offsets[0] = rawOffset; offsets[1] = offset - rawOffset; } return offset; }
Example 4
Source File: SimpleTimeZone.java From openjdk-jdk8u with GNU General Public License v2.0 | 5 votes |
/** * @see TimeZone#getOffsets */ int getOffsets(long date, int[] offsets) { int offset = rawOffset; computeOffset: if (useDaylight) { synchronized (this) { if (cacheStart != 0) { if (date >= cacheStart && date < cacheEnd) { offset += dstSavings; break computeOffset; } } } BaseCalendar cal = date >= GregorianCalendar.DEFAULT_GREGORIAN_CUTOVER ? gcal : (BaseCalendar) CalendarSystem.forName("julian"); BaseCalendar.Date cdate = (BaseCalendar.Date) cal.newCalendarDate(TimeZone.NO_TIMEZONE); // Get the year in local time cal.getCalendarDate(date + rawOffset, cdate); int year = cdate.getNormalizedYear(); if (year >= startYear) { // Clear time elements for the transition calculations cdate.setTimeOfDay(0, 0, 0, 0); offset = getOffset(cal, cdate, year, date); } } if (offsets != null) { offsets[0] = rawOffset; offsets[1] = offset - rawOffset; } return offset; }
Example 5
Source File: Date.java From openjdk-jdk8u with GNU General Public License v2.0 | 5 votes |
private final BaseCalendar.Date getCalendarDate() { if (cdate == null) { BaseCalendar cal = getCalendarSystem(fastTime); cdate = (BaseCalendar.Date) cal.getCalendarDate(fastTime, TimeZone.getDefaultRef()); } return cdate; }
Example 6
Source File: SimpleTimeZone.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 5 votes |
/** * @see TimeZone#getOffsets */ int getOffsets(long date, int[] offsets) { int offset = rawOffset; computeOffset: if (useDaylight) { synchronized (this) { if (cacheStart != 0) { if (date >= cacheStart && date < cacheEnd) { offset += dstSavings; break computeOffset; } } } BaseCalendar cal = date >= GregorianCalendar.DEFAULT_GREGORIAN_CUTOVER ? gcal : (BaseCalendar) CalendarSystem.forName("julian"); BaseCalendar.Date cdate = (BaseCalendar.Date) cal.newCalendarDate(TimeZone.NO_TIMEZONE); // Get the year in local time cal.getCalendarDate(date + rawOffset, cdate); int year = cdate.getNormalizedYear(); if (year >= startYear) { // Clear time elements for the transition calculations cdate.setTimeOfDay(0, 0, 0, 0); offset = getOffset(cal, cdate, year, date); } } if (offsets != null) { offsets[0] = rawOffset; offsets[1] = offset - rawOffset; } return offset; }
Example 7
Source File: SimpleTimeZone.java From JDKSourceCode1.8 with MIT License | 5 votes |
/** * @see TimeZone#getOffsets */ int getOffsets(long date, int[] offsets) { int offset = rawOffset; computeOffset: if (useDaylight) { synchronized (this) { if (cacheStart != 0) { if (date >= cacheStart && date < cacheEnd) { offset += dstSavings; break computeOffset; } } } BaseCalendar cal = date >= GregorianCalendar.DEFAULT_GREGORIAN_CUTOVER ? gcal : (BaseCalendar) CalendarSystem.forName("julian"); BaseCalendar.Date cdate = (BaseCalendar.Date) cal.newCalendarDate(TimeZone.NO_TIMEZONE); // Get the year in local time cal.getCalendarDate(date + rawOffset, cdate); int year = cdate.getNormalizedYear(); if (year >= startYear) { // Clear time elements for the transition calculations cdate.setTimeOfDay(0, 0, 0, 0); offset = getOffset(cal, cdate, year, date); } } if (offsets != null) { offsets[0] = rawOffset; offsets[1] = offset - rawOffset; } return offset; }
Example 8
Source File: Date.java From jdk-1.7-annotated with Apache License 2.0 | 5 votes |
private final BaseCalendar.Date getCalendarDate() { if (cdate == null) { BaseCalendar cal = getCalendarSystem(fastTime); cdate = (BaseCalendar.Date) cal.getCalendarDate(fastTime, TimeZone.getDefaultRef()); } return cdate; }
Example 9
Source File: SimpleTimeZone.java From TencentKona-8 with GNU General Public License v2.0 | 5 votes |
/** * @see TimeZone#getOffsets */ int getOffsets(long date, int[] offsets) { int offset = rawOffset; computeOffset: if (useDaylight) { synchronized (this) { if (cacheStart != 0) { if (date >= cacheStart && date < cacheEnd) { offset += dstSavings; break computeOffset; } } } BaseCalendar cal = date >= GregorianCalendar.DEFAULT_GREGORIAN_CUTOVER ? gcal : (BaseCalendar) CalendarSystem.forName("julian"); BaseCalendar.Date cdate = (BaseCalendar.Date) cal.newCalendarDate(TimeZone.NO_TIMEZONE); // Get the year in local time cal.getCalendarDate(date + rawOffset, cdate); int year = cdate.getNormalizedYear(); if (year >= startYear) { // Clear time elements for the transition calculations cdate.setTimeOfDay(0, 0, 0, 0); offset = getOffset(cal, cdate, year, date); } } if (offsets != null) { offsets[0] = rawOffset; offsets[1] = offset - rawOffset; } return offset; }
Example 10
Source File: Date.java From jdk8u_jdk with GNU General Public License v2.0 | 5 votes |
private final BaseCalendar.Date getCalendarDate() { if (cdate == null) { BaseCalendar cal = getCalendarSystem(fastTime); cdate = (BaseCalendar.Date) cal.getCalendarDate(fastTime, TimeZone.getDefaultRef()); } return cdate; }
Example 11
Source File: SimpleTimeZone.java From dragonwell8_jdk with GNU General Public License v2.0 | 5 votes |
/** * @see TimeZone#getOffsets */ int getOffsets(long date, int[] offsets) { int offset = rawOffset; computeOffset: if (useDaylight) { synchronized (this) { if (cacheStart != 0) { if (date >= cacheStart && date < cacheEnd) { offset += dstSavings; break computeOffset; } } } BaseCalendar cal = date >= GregorianCalendar.DEFAULT_GREGORIAN_CUTOVER ? gcal : (BaseCalendar) CalendarSystem.forName("julian"); BaseCalendar.Date cdate = (BaseCalendar.Date) cal.newCalendarDate(TimeZone.NO_TIMEZONE); // Get the year in local time cal.getCalendarDate(date + rawOffset, cdate); int year = cdate.getNormalizedYear(); if (year >= startYear) { // Clear time elements for the transition calculations cdate.setTimeOfDay(0, 0, 0, 0); offset = getOffset(cal, cdate, year, date); } } if (offsets != null) { offsets[0] = rawOffset; offsets[1] = offset - rawOffset; } return offset; }
Example 12
Source File: SimpleTimeZone.java From openjdk-8 with GNU General Public License v2.0 | 5 votes |
/** * @see TimeZone#getOffsets */ int getOffsets(long date, int[] offsets) { int offset = rawOffset; computeOffset: if (useDaylight) { synchronized (this) { if (cacheStart != 0) { if (date >= cacheStart && date < cacheEnd) { offset += dstSavings; break computeOffset; } } } BaseCalendar cal = date >= GregorianCalendar.DEFAULT_GREGORIAN_CUTOVER ? gcal : (BaseCalendar) CalendarSystem.forName("julian"); BaseCalendar.Date cdate = (BaseCalendar.Date) cal.newCalendarDate(TimeZone.NO_TIMEZONE); // Get the year in local time cal.getCalendarDate(date + rawOffset, cdate); int year = cdate.getNormalizedYear(); if (year >= startYear) { // Clear time elements for the transition calculations cdate.setTimeOfDay(0, 0, 0, 0); offset = getOffset(cal, cdate, year, date); } } if (offsets != null) { offsets[0] = rawOffset; offsets[1] = offset - rawOffset; } return offset; }
Example 13
Source File: SimpleTimeZone.java From jdk1.8-source-analysis with Apache License 2.0 | 5 votes |
/** * @see TimeZone#getOffsets */ int getOffsets(long date, int[] offsets) { int offset = rawOffset; computeOffset: if (useDaylight) { synchronized (this) { if (cacheStart != 0) { if (date >= cacheStart && date < cacheEnd) { offset += dstSavings; break computeOffset; } } } BaseCalendar cal = date >= GregorianCalendar.DEFAULT_GREGORIAN_CUTOVER ? gcal : (BaseCalendar) CalendarSystem.forName("julian"); BaseCalendar.Date cdate = (BaseCalendar.Date) cal.newCalendarDate(TimeZone.NO_TIMEZONE); // Get the year in local time cal.getCalendarDate(date + rawOffset, cdate); int year = cdate.getNormalizedYear(); if (year >= startYear) { // Clear time elements for the transition calculations cdate.setTimeOfDay(0, 0, 0, 0); offset = getOffset(cal, cdate, year, date); } } if (offsets != null) { offsets[0] = rawOffset; offsets[1] = offset - rawOffset; } return offset; }
Example 14
Source File: Date.java From jdk8u60 with GNU General Public License v2.0 | 4 votes |
/** * Creates a string representation of this <tt>Date</tt> object of * the form: * <blockquote><pre> * d mon yyyy hh:mm:ss GMT</pre></blockquote> * where:<ul> * <li><i>d</i> is the day of the month (<tt>1</tt> through <tt>31</tt>), * as one or two decimal digits. * <li><i>mon</i> is the month (<tt>Jan, Feb, Mar, Apr, May, Jun, Jul, * Aug, Sep, Oct, Nov, Dec</tt>). * <li><i>yyyy</i> is the year, as four decimal digits. * <li><i>hh</i> is the hour of the day (<tt>00</tt> through <tt>23</tt>), * as two decimal digits. * <li><i>mm</i> is the minute within the hour (<tt>00</tt> through * <tt>59</tt>), as two decimal digits. * <li><i>ss</i> is the second within the minute (<tt>00</tt> through * <tt>61</tt>), as two decimal digits. * <li><i>GMT</i> is exactly the ASCII letters "<tt>GMT</tt>" to indicate * Greenwich Mean Time. * </ul><p> * The result does not depend on the local time zone. * * @return a string representation of this date, using the Internet GMT * conventions. * @see java.text.DateFormat * @see java.util.Date#toString() * @see java.util.Date#toLocaleString() * @deprecated As of JDK version 1.1, * replaced by <code>DateFormat.format(Date date)</code>, using a * GMT <code>TimeZone</code>. */ @Deprecated public String toGMTString() { // d MMM yyyy HH:mm:ss 'GMT' long t = getTime(); BaseCalendar cal = getCalendarSystem(t); BaseCalendar.Date date = (BaseCalendar.Date) cal.getCalendarDate(getTime(), (TimeZone)null); StringBuilder sb = new StringBuilder(32); CalendarUtils.sprintf0d(sb, date.getDayOfMonth(), 1).append(' '); // d convertToAbbr(sb, wtb[date.getMonth() - 1 + 2 + 7]).append(' '); // MMM sb.append(date.getYear()).append(' '); // yyyy CalendarUtils.sprintf0d(sb, date.getHours(), 2).append(':'); // HH CalendarUtils.sprintf0d(sb, date.getMinutes(), 2).append(':'); // mm CalendarUtils.sprintf0d(sb, date.getSeconds(), 2); // ss sb.append(" GMT"); // ' GMT' return sb.toString(); }
Example 15
Source File: Date.java From Java8CN with Apache License 2.0 | 4 votes |
/** * Creates a string representation of this <tt>Date</tt> object of * the form: * <blockquote><pre> * d mon yyyy hh:mm:ss GMT</pre></blockquote> * where:<ul> * <li><i>d</i> is the day of the month (<tt>1</tt> through <tt>31</tt>), * as one or two decimal digits. * <li><i>mon</i> is the month (<tt>Jan, Feb, Mar, Apr, May, Jun, Jul, * Aug, Sep, Oct, Nov, Dec</tt>). * <li><i>yyyy</i> is the year, as four decimal digits. * <li><i>hh</i> is the hour of the day (<tt>00</tt> through <tt>23</tt>), * as two decimal digits. * <li><i>mm</i> is the minute within the hour (<tt>00</tt> through * <tt>59</tt>), as two decimal digits. * <li><i>ss</i> is the second within the minute (<tt>00</tt> through * <tt>61</tt>), as two decimal digits. * <li><i>GMT</i> is exactly the ASCII letters "<tt>GMT</tt>" to indicate * Greenwich Mean Time. * </ul><p> * The result does not depend on the local time zone. * * @return a string representation of this date, using the Internet GMT * conventions. * @see java.text.DateFormat * @see java.util.Date#toString() * @see java.util.Date#toLocaleString() * @deprecated As of JDK version 1.1, * replaced by <code>DateFormat.format(Date date)</code>, using a * GMT <code>TimeZone</code>. */ @Deprecated public String toGMTString() { // d MMM yyyy HH:mm:ss 'GMT' long t = getTime(); BaseCalendar cal = getCalendarSystem(t); BaseCalendar.Date date = (BaseCalendar.Date) cal.getCalendarDate(getTime(), (TimeZone)null); StringBuilder sb = new StringBuilder(32); CalendarUtils.sprintf0d(sb, date.getDayOfMonth(), 1).append(' '); // d convertToAbbr(sb, wtb[date.getMonth() - 1 + 2 + 7]).append(' '); // MMM sb.append(date.getYear()).append(' '); // yyyy CalendarUtils.sprintf0d(sb, date.getHours(), 2).append(':'); // HH CalendarUtils.sprintf0d(sb, date.getMinutes(), 2).append(':'); // mm CalendarUtils.sprintf0d(sb, date.getSeconds(), 2); // ss sb.append(" GMT"); // ' GMT' return sb.toString(); }
Example 16
Source File: Date.java From jdk8u-jdk with GNU General Public License v2.0 | 4 votes |
/** * Creates a string representation of this <tt>Date</tt> object of * the form: * <blockquote><pre> * d mon yyyy hh:mm:ss GMT</pre></blockquote> * where:<ul> * <li><i>d</i> is the day of the month (<tt>1</tt> through <tt>31</tt>), * as one or two decimal digits. * <li><i>mon</i> is the month (<tt>Jan, Feb, Mar, Apr, May, Jun, Jul, * Aug, Sep, Oct, Nov, Dec</tt>). * <li><i>yyyy</i> is the year, as four decimal digits. * <li><i>hh</i> is the hour of the day (<tt>00</tt> through <tt>23</tt>), * as two decimal digits. * <li><i>mm</i> is the minute within the hour (<tt>00</tt> through * <tt>59</tt>), as two decimal digits. * <li><i>ss</i> is the second within the minute (<tt>00</tt> through * <tt>61</tt>), as two decimal digits. * <li><i>GMT</i> is exactly the ASCII letters "<tt>GMT</tt>" to indicate * Greenwich Mean Time. * </ul><p> * The result does not depend on the local time zone. * * @return a string representation of this date, using the Internet GMT * conventions. * @see java.text.DateFormat * @see java.util.Date#toString() * @see java.util.Date#toLocaleString() * @deprecated As of JDK version 1.1, * replaced by <code>DateFormat.format(Date date)</code>, using a * GMT <code>TimeZone</code>. */ @Deprecated public String toGMTString() { // d MMM yyyy HH:mm:ss 'GMT' long t = getTime(); BaseCalendar cal = getCalendarSystem(t); BaseCalendar.Date date = (BaseCalendar.Date) cal.getCalendarDate(getTime(), (TimeZone)null); StringBuilder sb = new StringBuilder(32); CalendarUtils.sprintf0d(sb, date.getDayOfMonth(), 1).append(' '); // d convertToAbbr(sb, wtb[date.getMonth() - 1 + 2 + 7]).append(' '); // MMM sb.append(date.getYear()).append(' '); // yyyy CalendarUtils.sprintf0d(sb, date.getHours(), 2).append(':'); // HH CalendarUtils.sprintf0d(sb, date.getMinutes(), 2).append(':'); // mm CalendarUtils.sprintf0d(sb, date.getSeconds(), 2); // ss sb.append(" GMT"); // ' GMT' return sb.toString(); }
Example 17
Source File: Date.java From JDKSourceCode1.8 with MIT License | 4 votes |
/** * Creates a string representation of this <tt>Date</tt> object of * the form: * <blockquote><pre> * d mon yyyy hh:mm:ss GMT</pre></blockquote> * where:<ul> * <li><i>d</i> is the day of the month (<tt>1</tt> through <tt>31</tt>), * as one or two decimal digits. * <li><i>mon</i> is the month (<tt>Jan, Feb, Mar, Apr, May, Jun, Jul, * Aug, Sep, Oct, Nov, Dec</tt>). * <li><i>yyyy</i> is the year, as four decimal digits. * <li><i>hh</i> is the hour of the day (<tt>00</tt> through <tt>23</tt>), * as two decimal digits. * <li><i>mm</i> is the minute within the hour (<tt>00</tt> through * <tt>59</tt>), as two decimal digits. * <li><i>ss</i> is the second within the minute (<tt>00</tt> through * <tt>61</tt>), as two decimal digits. * <li><i>GMT</i> is exactly the ASCII letters "<tt>GMT</tt>" to indicate * Greenwich Mean Time. * </ul><p> * The result does not depend on the local time zone. * * @return a string representation of this date, using the Internet GMT * conventions. * @see java.text.DateFormat * @see java.util.Date#toString() * @see java.util.Date#toLocaleString() * @deprecated As of JDK version 1.1, * replaced by <code>DateFormat.format(Date date)</code>, using a * GMT <code>TimeZone</code>. */ @Deprecated public String toGMTString() { // d MMM yyyy HH:mm:ss 'GMT' long t = getTime(); BaseCalendar cal = getCalendarSystem(t); BaseCalendar.Date date = (BaseCalendar.Date) cal.getCalendarDate(getTime(), (TimeZone)null); StringBuilder sb = new StringBuilder(32); CalendarUtils.sprintf0d(sb, date.getDayOfMonth(), 1).append(' '); // d convertToAbbr(sb, wtb[date.getMonth() - 1 + 2 + 7]).append(' '); // MMM sb.append(date.getYear()).append(' '); // yyyy CalendarUtils.sprintf0d(sb, date.getHours(), 2).append(':'); // HH CalendarUtils.sprintf0d(sb, date.getMinutes(), 2).append(':'); // mm CalendarUtils.sprintf0d(sb, date.getSeconds(), 2); // ss sb.append(" GMT"); // ' GMT' return sb.toString(); }
Example 18
Source File: Date.java From openjdk-8-source with GNU General Public License v2.0 | 4 votes |
/** * Creates a string representation of this <tt>Date</tt> object of * the form: * <blockquote><pre> * d mon yyyy hh:mm:ss GMT</pre></blockquote> * where:<ul> * <li><i>d</i> is the day of the month (<tt>1</tt> through <tt>31</tt>), * as one or two decimal digits. * <li><i>mon</i> is the month (<tt>Jan, Feb, Mar, Apr, May, Jun, Jul, * Aug, Sep, Oct, Nov, Dec</tt>). * <li><i>yyyy</i> is the year, as four decimal digits. * <li><i>hh</i> is the hour of the day (<tt>00</tt> through <tt>23</tt>), * as two decimal digits. * <li><i>mm</i> is the minute within the hour (<tt>00</tt> through * <tt>59</tt>), as two decimal digits. * <li><i>ss</i> is the second within the minute (<tt>00</tt> through * <tt>61</tt>), as two decimal digits. * <li><i>GMT</i> is exactly the ASCII letters "<tt>GMT</tt>" to indicate * Greenwich Mean Time. * </ul><p> * The result does not depend on the local time zone. * * @return a string representation of this date, using the Internet GMT * conventions. * @see java.text.DateFormat * @see java.util.Date#toString() * @see java.util.Date#toLocaleString() * @deprecated As of JDK version 1.1, * replaced by <code>DateFormat.format(Date date)</code>, using a * GMT <code>TimeZone</code>. */ @Deprecated public String toGMTString() { // d MMM yyyy HH:mm:ss 'GMT' long t = getTime(); BaseCalendar cal = getCalendarSystem(t); BaseCalendar.Date date = (BaseCalendar.Date) cal.getCalendarDate(getTime(), (TimeZone)null); StringBuilder sb = new StringBuilder(32); CalendarUtils.sprintf0d(sb, date.getDayOfMonth(), 1).append(' '); // d convertToAbbr(sb, wtb[date.getMonth() - 1 + 2 + 7]).append(' '); // MMM sb.append(date.getYear()).append(' '); // yyyy CalendarUtils.sprintf0d(sb, date.getHours(), 2).append(':'); // HH CalendarUtils.sprintf0d(sb, date.getMinutes(), 2).append(':'); // mm CalendarUtils.sprintf0d(sb, date.getSeconds(), 2); // ss sb.append(" GMT"); // ' GMT' return sb.toString(); }
Example 19
Source File: Date.java From jdk-1.7-annotated with Apache License 2.0 | 4 votes |
/** * Creates a string representation of this <tt>Date</tt> object of * the form: * <blockquote<pre> * d mon yyyy hh:mm:ss GMT</pre></blockquote> * where:<ul> * <li><i>d</i> is the day of the month (<tt>1</tt> through <tt>31</tt>), * as one or two decimal digits. * <li><i>mon</i> is the month (<tt>Jan, Feb, Mar, Apr, May, Jun, Jul, * Aug, Sep, Oct, Nov, Dec</tt>). * <li><i>yyyy</i> is the year, as four decimal digits. * <li><i>hh</i> is the hour of the day (<tt>00</tt> through <tt>23</tt>), * as two decimal digits. * <li><i>mm</i> is the minute within the hour (<tt>00</tt> through * <tt>59</tt>), as two decimal digits. * <li><i>ss</i> is the second within the minute (<tt>00</tt> through * <tt>61</tt>), as two decimal digits. * <li><i>GMT</i> is exactly the ASCII letters "<tt>GMT</tt>" to indicate * Greenwich Mean Time. * </ul><p> * The result does not depend on the local time zone. * * @return a string representation of this date, using the Internet GMT * conventions. * @see java.text.DateFormat * @see java.util.Date#toString() * @see java.util.Date#toLocaleString() * @deprecated As of JDK version 1.1, * replaced by <code>DateFormat.format(Date date)</code>, using a * GMT <code>TimeZone</code>. */ @Deprecated public String toGMTString() { // d MMM yyyy HH:mm:ss 'GMT' long t = getTime(); BaseCalendar cal = getCalendarSystem(t); BaseCalendar.Date date = (BaseCalendar.Date) cal.getCalendarDate(getTime(), (TimeZone)null); StringBuilder sb = new StringBuilder(32); CalendarUtils.sprintf0d(sb, date.getDayOfMonth(), 1).append(' '); // d convertToAbbr(sb, wtb[date.getMonth() - 1 + 2 + 7]).append(' '); // MMM sb.append(date.getYear()).append(' '); // yyyy CalendarUtils.sprintf0d(sb, date.getHours(), 2).append(':'); // HH CalendarUtils.sprintf0d(sb, date.getMinutes(), 2).append(':'); // mm CalendarUtils.sprintf0d(sb, date.getSeconds(), 2); // ss sb.append(" GMT"); // ' GMT' return sb.toString(); }
Example 20
Source File: Date.java From jdk8u_jdk with GNU General Public License v2.0 | 4 votes |
/** * Creates a string representation of this <tt>Date</tt> object of * the form: * <blockquote><pre> * d mon yyyy hh:mm:ss GMT</pre></blockquote> * where:<ul> * <li><i>d</i> is the day of the month (<tt>1</tt> through <tt>31</tt>), * as one or two decimal digits. * <li><i>mon</i> is the month (<tt>Jan, Feb, Mar, Apr, May, Jun, Jul, * Aug, Sep, Oct, Nov, Dec</tt>). * <li><i>yyyy</i> is the year, as four decimal digits. * <li><i>hh</i> is the hour of the day (<tt>00</tt> through <tt>23</tt>), * as two decimal digits. * <li><i>mm</i> is the minute within the hour (<tt>00</tt> through * <tt>59</tt>), as two decimal digits. * <li><i>ss</i> is the second within the minute (<tt>00</tt> through * <tt>61</tt>), as two decimal digits. * <li><i>GMT</i> is exactly the ASCII letters "<tt>GMT</tt>" to indicate * Greenwich Mean Time. * </ul><p> * The result does not depend on the local time zone. * * @return a string representation of this date, using the Internet GMT * conventions. * @see java.text.DateFormat * @see java.util.Date#toString() * @see java.util.Date#toLocaleString() * @deprecated As of JDK version 1.1, * replaced by <code>DateFormat.format(Date date)</code>, using a * GMT <code>TimeZone</code>. */ @Deprecated public String toGMTString() { // d MMM yyyy HH:mm:ss 'GMT' long t = getTime(); BaseCalendar cal = getCalendarSystem(t); BaseCalendar.Date date = (BaseCalendar.Date) cal.getCalendarDate(getTime(), (TimeZone)null); StringBuilder sb = new StringBuilder(32); CalendarUtils.sprintf0d(sb, date.getDayOfMonth(), 1).append(' '); // d convertToAbbr(sb, wtb[date.getMonth() - 1 + 2 + 7]).append(' '); // MMM sb.append(date.getYear()).append(' '); // yyyy CalendarUtils.sprintf0d(sb, date.getHours(), 2).append(':'); // HH CalendarUtils.sprintf0d(sb, date.getMinutes(), 2).append(':'); // mm CalendarUtils.sprintf0d(sb, date.getSeconds(), 2); // ss sb.append(" GMT"); // ' GMT' return sb.toString(); }