java.text.DateFormat.checkDateStyle()方法的使用及代码示例

x33g5p2x  于2022-01-17 转载在 其他  
字(13.3k)|赞(0)|评价(0)|浏览(144)

本文整理了Java中java.text.DateFormat.checkDateStyle()方法的一些代码示例,展示了DateFormat.checkDateStyle()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。DateFormat.checkDateStyle()方法的具体详情如下:
包路径:java.text.DateFormat
类名称:DateFormat
方法名:checkDateStyle

DateFormat.checkDateStyle介绍

暂无

代码示例

代码示例来源:origin: robovm/robovm

/**
 * Returns a {@code DateFormat} instance for formatting and parsing dates in
 * the specified style for the user's default locale.
 * See "<a href="../util/Locale.html#default_locale">Be wary of the default locale</a>".
 * @param style
 *            one of SHORT, MEDIUM, LONG, FULL, or DEFAULT.
 * @return the {@code DateFormat} instance for {@code style} and the default
 *         locale.
 * @throws IllegalArgumentException
 *             if {@code style} is not one of SHORT, MEDIUM, LONG, FULL, or
 *             DEFAULT.
 */
public static final DateFormat getDateInstance(int style) {
  checkDateStyle(style);
  return getDateInstance(style, Locale.getDefault());
}

代码示例来源:origin: robovm/robovm

/**
 * Returns a {@code DateFormat} instance for formatting and parsing of both
 * dates and time values in the manner appropriate for the user's default locale.
 * See "<a href="../util/Locale.html#default_locale">Be wary of the default locale</a>".
 * @param dateStyle
 *            one of SHORT, MEDIUM, LONG, FULL, or DEFAULT.
 * @param timeStyle
 *            one of SHORT, MEDIUM, LONG, FULL, or DEFAULT.
 * @return the {@code DateFormat} instance for {@code dateStyle},
 *         {@code timeStyle} and the default locale.
 * @throws IllegalArgumentException
 *             if {@code dateStyle} or {@code timeStyle} is not one of
 *             SHORT, MEDIUM, LONG, FULL, or DEFAULT.
 */
public static final DateFormat getDateTimeInstance(int dateStyle, int timeStyle) {
  checkTimeStyle(timeStyle);
  checkDateStyle(dateStyle);
  return getDateTimeInstance(dateStyle, timeStyle, Locale.getDefault());
}

代码示例来源:origin: robovm/robovm

/**
 * Returns a {@code DateFormat} instance for formatting and parsing dates in
 * the specified style for the specified locale.
 *
 * @param style
 *            one of SHORT, MEDIUM, LONG, FULL, or DEFAULT.
 * @param locale
 *            the locale.
 * @throws IllegalArgumentException
 *             if {@code style} is not one of SHORT, MEDIUM, LONG, FULL, or
 *             DEFAULT.
 * @return the {@code DateFormat} instance for {@code style} and
 *         {@code locale}.
 */
public static final DateFormat getDateInstance(int style, Locale locale) {
  checkDateStyle(style);
  return new SimpleDateFormat(LocaleData.get(locale).getDateFormat(style), locale);
}

代码示例来源:origin: robovm/robovm

/**
 * Returns a {@code DateFormat} instance for formatting and parsing dates
 * and time values in the specified styles for the specified locale.
 *
 * @param dateStyle
 *            one of SHORT, MEDIUM, LONG, FULL, or DEFAULT.
 * @param timeStyle
 *            one of SHORT, MEDIUM, LONG, FULL, or DEFAULT.
 * @param locale
 *            the locale.
 * @return the {@code DateFormat} instance for {@code dateStyle},
 *         {@code timeStyle} and {@code locale}.
 * @throws IllegalArgumentException
 *             if {@code dateStyle} or {@code timeStyle} is not one of
 *             SHORT, MEDIUM, LONG, FULL, or DEFAULT.
 */
public static final DateFormat getDateTimeInstance(int dateStyle, int timeStyle, Locale locale) {
  checkTimeStyle(timeStyle);
  checkDateStyle(dateStyle);
  LocaleData localeData = LocaleData.get(locale);
  String pattern = localeData.getDateFormat(dateStyle) + " " + localeData.getTimeFormat(timeStyle);
  return new SimpleDateFormat(pattern, locale);
}

代码示例来源:origin: ibinti/bugvm

/**
 * Returns a {@code DateFormat} instance for formatting and parsing dates in
 * the specified style for the user's default locale.
 * See "<a href="../util/Locale.html#default_locale">Be wary of the default locale</a>".
 * @param style
 *            one of SHORT, MEDIUM, LONG, FULL, or DEFAULT.
 * @return the {@code DateFormat} instance for {@code style} and the default
 *         locale.
 * @throws IllegalArgumentException
 *             if {@code style} is not one of SHORT, MEDIUM, LONG, FULL, or
 *             DEFAULT.
 */
public static final DateFormat getDateInstance(int style) {
  checkDateStyle(style);
  return getDateInstance(style, Locale.getDefault());
}

代码示例来源:origin: com.mobidevelop.robovm/robovm-rt

/**
 * Returns a {@code DateFormat} instance for formatting and parsing dates in
 * the specified style for the user's default locale.
 * See "<a href="../util/Locale.html#default_locale">Be wary of the default locale</a>".
 * @param style
 *            one of SHORT, MEDIUM, LONG, FULL, or DEFAULT.
 * @return the {@code DateFormat} instance for {@code style} and the default
 *         locale.
 * @throws IllegalArgumentException
 *             if {@code style} is not one of SHORT, MEDIUM, LONG, FULL, or
 *             DEFAULT.
 */
public static final DateFormat getDateInstance(int style) {
  checkDateStyle(style);
  return getDateInstance(style, Locale.getDefault());
}

代码示例来源:origin: com.gluonhq/robovm-rt

/**
 * Returns a {@code DateFormat} instance for formatting and parsing dates in
 * the specified style for the user's default locale.
 * See "<a href="../util/Locale.html#default_locale">Be wary of the default locale</a>".
 * @param style
 *            one of SHORT, MEDIUM, LONG, FULL, or DEFAULT.
 * @return the {@code DateFormat} instance for {@code style} and the default
 *         locale.
 * @throws IllegalArgumentException
 *             if {@code style} is not one of SHORT, MEDIUM, LONG, FULL, or
 *             DEFAULT.
 */
public static final DateFormat getDateInstance(int style) {
  checkDateStyle(style);
  return getDateInstance(style, Locale.getDefault());
}

代码示例来源:origin: MobiVM/robovm

/**
 * Returns a {@code DateFormat} instance for formatting and parsing dates in
 * the specified style for the user's default locale.
 * See "<a href="../util/Locale.html#default_locale">Be wary of the default locale</a>".
 * @param style
 *            one of SHORT, MEDIUM, LONG, FULL, or DEFAULT.
 * @return the {@code DateFormat} instance for {@code style} and the default
 *         locale.
 * @throws IllegalArgumentException
 *             if {@code style} is not one of SHORT, MEDIUM, LONG, FULL, or
 *             DEFAULT.
 */
public static final DateFormat getDateInstance(int style) {
  checkDateStyle(style);
  return getDateInstance(style, Locale.getDefault());
}

代码示例来源:origin: com.bugvm/bugvm-rt

/**
 * Returns a {@code DateFormat} instance for formatting and parsing dates in
 * the specified style for the user's default locale.
 * See "<a href="../util/Locale.html#default_locale">Be wary of the default locale</a>".
 * @param style
 *            one of SHORT, MEDIUM, LONG, FULL, or DEFAULT.
 * @return the {@code DateFormat} instance for {@code style} and the default
 *         locale.
 * @throws IllegalArgumentException
 *             if {@code style} is not one of SHORT, MEDIUM, LONG, FULL, or
 *             DEFAULT.
 */
public static final DateFormat getDateInstance(int style) {
  checkDateStyle(style);
  return getDateInstance(style, Locale.getDefault());
}

代码示例来源:origin: FlexoVM/flexovm

/**
 * Returns a {@code DateFormat} instance for formatting and parsing dates in
 * the specified style for the user's default locale.
 * See "<a href="../util/Locale.html#default_locale">Be wary of the default locale</a>".
 * @param style
 *            one of SHORT, MEDIUM, LONG, FULL, or DEFAULT.
 * @return the {@code DateFormat} instance for {@code style} and the default
 *         locale.
 * @throws IllegalArgumentException
 *             if {@code style} is not one of SHORT, MEDIUM, LONG, FULL, or
 *             DEFAULT.
 */
public static final DateFormat getDateInstance(int style) {
  checkDateStyle(style);
  return getDateInstance(style, Locale.getDefault());
}

代码示例来源:origin: ibinti/bugvm

/**
 * Returns a {@code DateFormat} instance for formatting and parsing of both
 * dates and time values in the manner appropriate for the user's default locale.
 * See "<a href="../util/Locale.html#default_locale">Be wary of the default locale</a>".
 * @param dateStyle
 *            one of SHORT, MEDIUM, LONG, FULL, or DEFAULT.
 * @param timeStyle
 *            one of SHORT, MEDIUM, LONG, FULL, or DEFAULT.
 * @return the {@code DateFormat} instance for {@code dateStyle},
 *         {@code timeStyle} and the default locale.
 * @throws IllegalArgumentException
 *             if {@code dateStyle} or {@code timeStyle} is not one of
 *             SHORT, MEDIUM, LONG, FULL, or DEFAULT.
 */
public static final DateFormat getDateTimeInstance(int dateStyle, int timeStyle) {
  checkTimeStyle(timeStyle);
  checkDateStyle(dateStyle);
  return getDateTimeInstance(dateStyle, timeStyle, Locale.getDefault());
}

代码示例来源:origin: MobiVM/robovm

/**
 * Returns a {@code DateFormat} instance for formatting and parsing of both
 * dates and time values in the manner appropriate for the user's default locale.
 * See "<a href="../util/Locale.html#default_locale">Be wary of the default locale</a>".
 * @param dateStyle
 *            one of SHORT, MEDIUM, LONG, FULL, or DEFAULT.
 * @param timeStyle
 *            one of SHORT, MEDIUM, LONG, FULL, or DEFAULT.
 * @return the {@code DateFormat} instance for {@code dateStyle},
 *         {@code timeStyle} and the default locale.
 * @throws IllegalArgumentException
 *             if {@code dateStyle} or {@code timeStyle} is not one of
 *             SHORT, MEDIUM, LONG, FULL, or DEFAULT.
 */
public static final DateFormat getDateTimeInstance(int dateStyle, int timeStyle) {
  checkTimeStyle(timeStyle);
  checkDateStyle(dateStyle);
  return getDateTimeInstance(dateStyle, timeStyle, Locale.getDefault());
}

代码示例来源:origin: com.mobidevelop.robovm/robovm-rt

/**
 * Returns a {@code DateFormat} instance for formatting and parsing of both
 * dates and time values in the manner appropriate for the user's default locale.
 * See "<a href="../util/Locale.html#default_locale">Be wary of the default locale</a>".
 * @param dateStyle
 *            one of SHORT, MEDIUM, LONG, FULL, or DEFAULT.
 * @param timeStyle
 *            one of SHORT, MEDIUM, LONG, FULL, or DEFAULT.
 * @return the {@code DateFormat} instance for {@code dateStyle},
 *         {@code timeStyle} and the default locale.
 * @throws IllegalArgumentException
 *             if {@code dateStyle} or {@code timeStyle} is not one of
 *             SHORT, MEDIUM, LONG, FULL, or DEFAULT.
 */
public static final DateFormat getDateTimeInstance(int dateStyle, int timeStyle) {
  checkTimeStyle(timeStyle);
  checkDateStyle(dateStyle);
  return getDateTimeInstance(dateStyle, timeStyle, Locale.getDefault());
}

代码示例来源:origin: com.gluonhq/robovm-rt

/**
 * Returns a {@code DateFormat} instance for formatting and parsing of both
 * dates and time values in the manner appropriate for the user's default locale.
 * See "<a href="../util/Locale.html#default_locale">Be wary of the default locale</a>".
 * @param dateStyle
 *            one of SHORT, MEDIUM, LONG, FULL, or DEFAULT.
 * @param timeStyle
 *            one of SHORT, MEDIUM, LONG, FULL, or DEFAULT.
 * @return the {@code DateFormat} instance for {@code dateStyle},
 *         {@code timeStyle} and the default locale.
 * @throws IllegalArgumentException
 *             if {@code dateStyle} or {@code timeStyle} is not one of
 *             SHORT, MEDIUM, LONG, FULL, or DEFAULT.
 */
public static final DateFormat getDateTimeInstance(int dateStyle, int timeStyle) {
  checkTimeStyle(timeStyle);
  checkDateStyle(dateStyle);
  return getDateTimeInstance(dateStyle, timeStyle, Locale.getDefault());
}

代码示例来源:origin: com.bugvm/bugvm-rt

/**
 * Returns a {@code DateFormat} instance for formatting and parsing of both
 * dates and time values in the manner appropriate for the user's default locale.
 * See "<a href="../util/Locale.html#default_locale">Be wary of the default locale</a>".
 * @param dateStyle
 *            one of SHORT, MEDIUM, LONG, FULL, or DEFAULT.
 * @param timeStyle
 *            one of SHORT, MEDIUM, LONG, FULL, or DEFAULT.
 * @return the {@code DateFormat} instance for {@code dateStyle},
 *         {@code timeStyle} and the default locale.
 * @throws IllegalArgumentException
 *             if {@code dateStyle} or {@code timeStyle} is not one of
 *             SHORT, MEDIUM, LONG, FULL, or DEFAULT.
 */
public static final DateFormat getDateTimeInstance(int dateStyle, int timeStyle) {
  checkTimeStyle(timeStyle);
  checkDateStyle(dateStyle);
  return getDateTimeInstance(dateStyle, timeStyle, Locale.getDefault());
}

代码示例来源:origin: ibinti/bugvm

/**
 * Returns a {@code DateFormat} instance for formatting and parsing dates in
 * the specified style for the specified locale.
 *
 * @param style
 *            one of SHORT, MEDIUM, LONG, FULL, or DEFAULT.
 * @param locale
 *            the locale.
 * @throws IllegalArgumentException
 *             if {@code style} is not one of SHORT, MEDIUM, LONG, FULL, or
 *             DEFAULT.
 * @return the {@code DateFormat} instance for {@code style} and
 *         {@code locale}.
 */
public static final DateFormat getDateInstance(int style, Locale locale) {
  checkDateStyle(style);
  return new SimpleDateFormat(LocaleData.get(locale).getDateFormat(style), locale);
}

代码示例来源:origin: MobiVM/robovm

/**
 * Returns a {@code DateFormat} instance for formatting and parsing dates in
 * the specified style for the specified locale.
 *
 * @param style
 *            one of SHORT, MEDIUM, LONG, FULL, or DEFAULT.
 * @param locale
 *            the locale.
 * @throws IllegalArgumentException
 *             if {@code style} is not one of SHORT, MEDIUM, LONG, FULL, or
 *             DEFAULT.
 * @return the {@code DateFormat} instance for {@code style} and
 *         {@code locale}.
 */
public static final DateFormat getDateInstance(int style, Locale locale) {
  checkDateStyle(style);
  return new SimpleDateFormat(LocaleData.get(locale).getDateFormat(style), locale);
}

代码示例来源:origin: com.bugvm/bugvm-rt

/**
 * Returns a {@code DateFormat} instance for formatting and parsing dates in
 * the specified style for the specified locale.
 *
 * @param style
 *            one of SHORT, MEDIUM, LONG, FULL, or DEFAULT.
 * @param locale
 *            the locale.
 * @throws IllegalArgumentException
 *             if {@code style} is not one of SHORT, MEDIUM, LONG, FULL, or
 *             DEFAULT.
 * @return the {@code DateFormat} instance for {@code style} and
 *         {@code locale}.
 */
public static final DateFormat getDateInstance(int style, Locale locale) {
  checkDateStyle(style);
  return new SimpleDateFormat(LocaleData.get(locale).getDateFormat(style), locale);
}

代码示例来源:origin: com.mobidevelop.robovm/robovm-rt

/**
 * Returns a {@code DateFormat} instance for formatting and parsing dates in
 * the specified style for the specified locale.
 *
 * @param style
 *            one of SHORT, MEDIUM, LONG, FULL, or DEFAULT.
 * @param locale
 *            the locale.
 * @throws IllegalArgumentException
 *             if {@code style} is not one of SHORT, MEDIUM, LONG, FULL, or
 *             DEFAULT.
 * @return the {@code DateFormat} instance for {@code style} and
 *         {@code locale}.
 */
public static final DateFormat getDateInstance(int style, Locale locale) {
  checkDateStyle(style);
  return new SimpleDateFormat(LocaleData.get(locale).getDateFormat(style), locale);
}

代码示例来源:origin: com.gluonhq/robovm-rt

/**
 * Returns a {@code DateFormat} instance for formatting and parsing dates in
 * the specified style for the specified locale.
 *
 * @param style
 *            one of SHORT, MEDIUM, LONG, FULL, or DEFAULT.
 * @param locale
 *            the locale.
 * @throws IllegalArgumentException
 *             if {@code style} is not one of SHORT, MEDIUM, LONG, FULL, or
 *             DEFAULT.
 * @return the {@code DateFormat} instance for {@code style} and
 *         {@code locale}.
 */
public static final DateFormat getDateInstance(int style, Locale locale) {
  checkDateStyle(style);
  return new SimpleDateFormat(LocaleData.get(locale).getDateFormat(style), locale);
}

相关文章