Java Code Examples for java.text.SimpleDateFormat#getCalendar()
The following examples show how to use
java.text.SimpleDateFormat#getCalendar() .
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: DateFormatProviderImpl.java From dragonwell8_jdk with GNU General Public License v2.0 | 6 votes |
private DateFormat getInstance(int dateStyle, int timeStyle, Locale locale) { if (locale == null) { throw new NullPointerException(); } SimpleDateFormat sdf = new SimpleDateFormat("", locale); Calendar cal = sdf.getCalendar(); try { String pattern = LocaleProviderAdapter.forType(type) .getLocaleResources(locale).getDateTimePattern(timeStyle, dateStyle, cal); sdf.applyPattern(pattern); } catch (MissingResourceException mre) { // Specify the fallback pattern sdf.applyPattern("M/d/yy h:mm a"); } return sdf; }
Example 2
Source File: DateFormatProviderImpl.java From TencentKona-8 with GNU General Public License v2.0 | 6 votes |
private DateFormat getInstance(int dateStyle, int timeStyle, Locale locale) { if (locale == null) { throw new NullPointerException(); } SimpleDateFormat sdf = new SimpleDateFormat("", locale); Calendar cal = sdf.getCalendar(); try { String pattern = LocaleProviderAdapter.forType(type) .getLocaleResources(locale).getDateTimePattern(timeStyle, dateStyle, cal); sdf.applyPattern(pattern); } catch (MissingResourceException mre) { // Specify the fallback pattern sdf.applyPattern("M/d/yy h:mm a"); } return sdf; }
Example 3
Source File: DateFormatProviderImpl.java From jdk8u60 with GNU General Public License v2.0 | 6 votes |
private DateFormat getInstance(int dateStyle, int timeStyle, Locale locale) { if (locale == null) { throw new NullPointerException(); } SimpleDateFormat sdf = new SimpleDateFormat("", locale); Calendar cal = sdf.getCalendar(); try { String pattern = LocaleProviderAdapter.forType(type) .getLocaleResources(locale).getDateTimePattern(timeStyle, dateStyle, cal); sdf.applyPattern(pattern); } catch (MissingResourceException mre) { // Specify the fallback pattern sdf.applyPattern("M/d/yy h:mm a"); } return sdf; }
Example 4
Source File: DateFormatProviderImpl.java From openjdk-jdk8u with GNU General Public License v2.0 | 6 votes |
private DateFormat getInstance(int dateStyle, int timeStyle, Locale locale) { if (locale == null) { throw new NullPointerException(); } SimpleDateFormat sdf = new SimpleDateFormat("", locale); Calendar cal = sdf.getCalendar(); try { String pattern = LocaleProviderAdapter.forType(type) .getLocaleResources(locale).getDateTimePattern(timeStyle, dateStyle, cal); sdf.applyPattern(pattern); } catch (MissingResourceException mre) { // Specify the fallback pattern sdf.applyPattern("M/d/yy h:mm a"); } return sdf; }
Example 5
Source File: DateFormatProviderImpl.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 6 votes |
private DateFormat getInstance(int dateStyle, int timeStyle, Locale locale) { if (locale == null) { throw new NullPointerException(); } SimpleDateFormat sdf = new SimpleDateFormat("", locale); Calendar cal = sdf.getCalendar(); try { String pattern = LocaleProviderAdapter.forType(type) .getLocaleResources(locale).getDateTimePattern(timeStyle, dateStyle, cal); sdf.applyPattern(pattern); } catch (MissingResourceException mre) { // Specify the fallback pattern sdf.applyPattern("M/d/yy h:mm a"); } return sdf; }
Example 6
Source File: DateFormatProviderImpl.java From openjdk-jdk9 with GNU General Public License v2.0 | 6 votes |
private DateFormat getInstance(int dateStyle, int timeStyle, Locale locale) { if (locale == null) { throw new NullPointerException(); } SimpleDateFormat sdf = new SimpleDateFormat("", locale); Calendar cal = sdf.getCalendar(); try { String pattern = LocaleProviderAdapter.forType(type) .getLocaleResources(locale).getDateTimePattern(timeStyle, dateStyle, cal); sdf.applyPattern(pattern); } catch (MissingResourceException mre) { // Specify the fallback pattern sdf.applyPattern("M/d/yy h:mm a"); } return sdf; }
Example 7
Source File: DateFormatProviderImpl.java From jdk8u-jdk with GNU General Public License v2.0 | 6 votes |
private DateFormat getInstance(int dateStyle, int timeStyle, Locale locale) { if (locale == null) { throw new NullPointerException(); } SimpleDateFormat sdf = new SimpleDateFormat("", locale); Calendar cal = sdf.getCalendar(); try { String pattern = LocaleProviderAdapter.forType(type) .getLocaleResources(locale).getDateTimePattern(timeStyle, dateStyle, cal); sdf.applyPattern(pattern); } catch (MissingResourceException mre) { // Specify the fallback pattern sdf.applyPattern("M/d/yy h:mm a"); } return sdf; }
Example 8
Source File: DateFormatProviderImpl.java From hottub with GNU General Public License v2.0 | 6 votes |
private DateFormat getInstance(int dateStyle, int timeStyle, Locale locale) { if (locale == null) { throw new NullPointerException(); } SimpleDateFormat sdf = new SimpleDateFormat("", locale); Calendar cal = sdf.getCalendar(); try { String pattern = LocaleProviderAdapter.forType(type) .getLocaleResources(locale).getDateTimePattern(timeStyle, dateStyle, cal); sdf.applyPattern(pattern); } catch (MissingResourceException mre) { // Specify the fallback pattern sdf.applyPattern("M/d/yy h:mm a"); } return sdf; }
Example 9
Source File: DateFormatProviderImpl.java From openjdk-8-source with GNU General Public License v2.0 | 6 votes |
private DateFormat getInstance(int dateStyle, int timeStyle, Locale locale) { if (locale == null) { throw new NullPointerException(); } SimpleDateFormat sdf = new SimpleDateFormat("", locale); Calendar cal = sdf.getCalendar(); try { String pattern = LocaleProviderAdapter.forType(type) .getLocaleResources(locale).getDateTimePattern(timeStyle, dateStyle, cal); sdf.applyPattern(pattern); } catch (MissingResourceException mre) { // Specify the fallback pattern sdf.applyPattern("M/d/yy h:mm a"); } return sdf; }
Example 10
Source File: DateFormatProviderImpl.java From openjdk-8 with GNU General Public License v2.0 | 6 votes |
private DateFormat getInstance(int dateStyle, int timeStyle, Locale locale) { if (locale == null) { throw new NullPointerException(); } SimpleDateFormat sdf = new SimpleDateFormat("", locale); Calendar cal = sdf.getCalendar(); try { String pattern = LocaleProviderAdapter.forType(type) .getLocaleResources(locale).getDateTimePattern(timeStyle, dateStyle, cal); sdf.applyPattern(pattern); } catch (MissingResourceException mre) { // Specify the fallback pattern sdf.applyPattern("M/d/yy h:mm a"); } return sdf; }
Example 11
Source File: DateFormatProviderImpl.java From jdk8u_jdk with GNU General Public License v2.0 | 6 votes |
private DateFormat getInstance(int dateStyle, int timeStyle, Locale locale) { if (locale == null) { throw new NullPointerException(); } SimpleDateFormat sdf = new SimpleDateFormat("", locale); Calendar cal = sdf.getCalendar(); try { String pattern = LocaleProviderAdapter.forType(type) .getLocaleResources(locale).getDateTimePattern(timeStyle, dateStyle, cal); sdf.applyPattern(pattern); } catch (MissingResourceException mre) { // Specify the fallback pattern sdf.applyPattern("M/d/yy h:mm a"); } return sdf; }
Example 12
Source File: DateFormatProviderImpl.java From jdk8u-jdk with GNU General Public License v2.0 | 6 votes |
private DateFormat getInstance(int dateStyle, int timeStyle, Locale locale) { if (locale == null) { throw new NullPointerException(); } SimpleDateFormat sdf = new SimpleDateFormat("", locale); Calendar cal = sdf.getCalendar(); try { String pattern = LocaleProviderAdapter.forType(type) .getLocaleResources(locale).getDateTimePattern(timeStyle, dateStyle, cal); sdf.applyPattern(pattern); } catch (MissingResourceException mre) { // Specify the fallback pattern sdf.applyPattern("M/d/yy h:mm a"); } return sdf; }
Example 13
Source File: DateFormatProviderImpl.java From jdk8u-dev-jdk with GNU General Public License v2.0 | 6 votes |
private DateFormat getInstance(int dateStyle, int timeStyle, Locale locale) { if (locale == null) { throw new NullPointerException(); } SimpleDateFormat sdf = new SimpleDateFormat("", locale); Calendar cal = sdf.getCalendar(); try { String pattern = LocaleProviderAdapter.forType(type) .getLocaleResources(locale).getDateTimePattern(timeStyle, dateStyle, cal); sdf.applyPattern(pattern); } catch (MissingResourceException mre) { // Specify the fallback pattern sdf.applyPattern("M/d/yy h:mm a"); } return sdf; }
Example 14
Source File: DateFormatProviderImpl.java From Bytecoder with Apache License 2.0 | 5 votes |
private DateFormat getInstance(int dateStyle, int timeStyle, Locale locale) { if (locale == null) { throw new NullPointerException(); } // Check for region override Locale rg = CalendarDataUtility.findRegionOverride(locale); SimpleDateFormat sdf = new SimpleDateFormat("", rg); Calendar cal = sdf.getCalendar(); try { String pattern = LocaleProviderAdapter.forType(type) .getLocaleResources(rg).getDateTimePattern(timeStyle, dateStyle, cal); sdf.applyPattern(pattern); } catch (MissingResourceException mre) { // Specify the fallback pattern sdf.applyPattern("M/d/yy h:mm a"); } // Check for timezone override String tz = locale.getUnicodeLocaleType("tz"); if (tz != null) { sdf.setTimeZone( TimeZoneNameUtility.convertLDMLShortID(tz) .map(TimeZone::getTimeZone) .orElseGet(sdf::getTimeZone)); } return sdf; }
Example 15
Source File: Bug4442855.java From openjdk-jdk9 with GNU General Public License v2.0 | 5 votes |
private boolean TestBC(){ Locale zhTWloc = new Locale("zh", "TW"); SimpleDateFormat sdf = new SimpleDateFormat("G", zhTWloc); Calendar cdar = sdf.getCalendar(); cdar.set(-2000, 1, 1); return Test(sdf.format(cdar.getTime()), "\u897f\u5143\u524d", "BC"); }