java.text.SimpleDateFormat.getDateFormatSymbols()方法的使用及代码示例

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

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

SimpleDateFormat.getDateFormatSymbols介绍

[英]Returns the DateFormatSymbols used by this simple date format.
[中]返回此简单日期格式使用的日期格式符号。

代码示例

代码示例来源:origin: pentaho/pentaho-kettle

/**
 * Applies the given pattern string to this date format.
 *
 * @param pattern the new date and time pattern for this date format
 * @throws NullPointerException     if the given pattern is null
 * @throws IllegalArgumentException if the given pattern is invalid
 */
@Override
public void applyPattern( String pattern ) {
 DateFormatSymbols formatSymbols = super.getDateFormatSymbols();
 init( pattern, formatSymbols, false );
}

代码示例来源:origin: pentaho/pentaho-kettle

/**
 * Applies the given localized pattern string to this date format.
 *
 * @param pattern a String to be mapped to the new date and time format pattern for this format
 * @throws NullPointerException     if the given pattern is null
 * @throws IllegalArgumentException if the given pattern is invalid
 */
@Override
public void applyLocalizedPattern( String pattern ) {
 DateFormatSymbols formatSymbols = super.getDateFormatSymbols();
 init( pattern, formatSymbols, true );
}

代码示例来源:origin: stackoverflow.com

return localSimpleDateFormat.get().getDateFormatSymbols();

代码示例来源:origin: commons-net/commons-net

/**
 * @return returns an array of 12 strings representing the short
 * month names used by this parse.
 */
public String[] getShortMonths() {
  return defaultDateFormat.getDateFormatSymbols().getShortMonths();
}

代码示例来源:origin: stackoverflow.com

import java.util.*;
import java.text.*;

public class Test {
  public static void main(String[] args) throws Exception {
    String text = "2013-05-23T09:18:07 p.m..380+0000";
    String pattern = "yyyy-MM-dd'T'hh:mm:ss aa'.380+0000'";

    SimpleDateFormat format = new SimpleDateFormat(pattern, Locale.US);
    format.setTimeZone(TimeZone.getTimeZone("UTC"));

    DateFormatSymbols symbols = format.getDateFormatSymbols();
    symbols = (DateFormatSymbols) symbols.clone();
    symbols.setAmPmStrings(new String[] { "a.m.", "p.m."});
    format.setDateFormatSymbols(symbols);

    Date date = format.parse(text);
    System.out.println(date);
  }
}

代码示例来源:origin: commons-net/commons-net

String timeStampStrPlusYear = timestampStr + " " + year;
SimpleDateFormat hackFormatter = new SimpleDateFormat(recentDateFormat.toPattern() + " yyyy",
    recentDateFormat.getDateFormatSymbols());
hackFormatter.setLenient(false);
hackFormatter.setTimeZone(recentDateFormat.getTimeZone());

代码示例来源:origin: org.refcodes/refcodes-date

/**
 * {@inheritDoc}
 * 
 * @deprecated as it is not considered to be thread safe.
 */
@Deprecated
@Override
public DateFormatSymbols getDateFormatSymbols() {
  return super.getDateFormatSymbols();
}

代码示例来源:origin: com.arialyy.aria/aria-ftp-plug

/**
 * @return returns an array of 12 strings representing the short
 * month names used by this parse.
 */
public String[] getShortMonths() {
 return defaultDateFormat.getDateFormatSymbols().getShortMonths();
}

代码示例来源:origin: org.apache.commons/com.springsource.org.apache.commons.net

/**
 * @return returns an array of 12 strings representing the short
 * month names used by this parse.
 */
public String[] getShortMonths() {
  return defaultDateFormat.getDateFormatSymbols().getShortMonths();
}

代码示例来源:origin: at.bestsolution.eclipse/com.ibm.icu.base

/**
 * Gets the date/time formatting data.
 * @return a copy of the date-time formatting data associated
 * with this date-time formatter.
 * @stable ICU 2.0
 */
public DateFormatSymbols getDateFormatSymbols() {
  return new DateFormatSymbols(((java.text.SimpleDateFormat)dateFormat).getDateFormatSymbols());
}

代码示例来源:origin: io.prestosql.hadoop/hadoop-apache

/**
 * @return returns an array of 12 strings representing the short
 * month names used by this parse.
 */
public String[] getShortMonths() {
  return defaultDateFormat.getDateFormatSymbols().getShortMonths();
}

代码示例来源:origin: org.xbib/ftp-client

/**
 * @return returns an array of 12 strings representing the short
 * month names used by this parse.
 */
public String[] getShortMonths() {
  return defaultDateFormat.getDateFormatSymbols().getShortMonths();
}

代码示例来源:origin: org.apache.empire-db/empire-db

public static String formatMonth(int month, Locale locale, boolean longFormat)
{
  SimpleDateFormat sdf = new SimpleDateFormat("", getSafeLocale(locale));
  if (longFormat)
    return sdf.getDateFormatSymbols().getMonths()[month];
  else
    return sdf.getDateFormatSymbols().getShortMonths()[month];
}

代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.commons-net

/**
 * @return returns an array of 12 strings representing the short
 * month names used by this parse.
 */
public String[] getShortMonths() {
  return defaultDateFormat.getDateFormatSymbols().getShortMonths();
}

代码示例来源:origin: org.apache.empire-db/empire-db

public static String formatMonth(Date d, Locale locale, boolean longFormat)
{
  SimpleDateFormat sdf = new SimpleDateFormat("", getSafeLocale(locale));
  Calendar c = Calendar.getInstance(getSafeLocale(locale));
  c.setTime(d);
  int month = c.get(Calendar.MONTH);
  if (longFormat)
    return sdf.getDateFormatSymbols().getMonths()[month];
  else
    return sdf.getDateFormatSymbols().getShortMonths()[month];
}

代码示例来源:origin: stackoverflow.com

SimpleDateFormat sdf = new SimpleDateFormat("'z dnia' dd MMMM yyyy 'r.'");

DateFormatSymbols dfs = sdf.getDateFormatSymbols();

dfs.setMonths(
  new String[] {
    "stycznia", "lutego", "marca", "kwietnia", "maja", "czerwca",
    "lipca", "sierpnia", "września", "października", "listopada",
    "grudnia"   
  });

sdf.setDateFormatSymbols(dfs);

System.out.println(
  sdf.format(new GregorianCalendar(2012, Calendar.DECEMBER, 28).getTime()));

代码示例来源:origin: org.apache.empire-db/empire-db

public static String formatDayOfWeek(Date d, Locale locale, boolean longFormat)
{
  SimpleDateFormat sdf = new SimpleDateFormat("", getSafeLocale(locale));
  Calendar c = Calendar.getInstance(getSafeLocale(locale));
  c.setTime(d);
  int dayOfWeek = c.get(Calendar.DAY_OF_WEEK);
  if (longFormat)
    return sdf.getDateFormatSymbols().getWeekdays()[dayOfWeek];
  else
    return sdf.getDateFormatSymbols().getShortWeekdays()[dayOfWeek];
}

代码示例来源:origin: stackoverflow.com

SimpleDateFormat df = new SimpleDateFormat("EEE, dd MMM yyyy HH:mm:ss Z",
     Locale.GERMAN);
 DateFormatSymbols dfs = df.getDateFormatSymbols();
 String[] swd = {"", "So", "Mo", "Di", "Mi", "Do", "Fr", "Sa"};
 dfs.setShortWeekdays(swd);
 df.setDateFormatSymbols(dfs);

代码示例来源:origin: EvoSuite/evosuite

public DateFormatSymbols getDateFormatSymbols()
{
  Capturer.capture(Instrumenter.CAPTURE_ID_JAVA_TEXT_SIMPLEDATEFORMAT, this, "getDateFormatSymbols", "()Ljava/text/DateFormatSymbols;", new Object[] {});
  DateFormatSymbols ret = super.getDateFormatSymbols();
  Capturer.enable(Instrumenter.CAPTURE_ID_JAVA_TEXT_SIMPLEDATEFORMAT, this, ret);		
  return ret;
}

代码示例来源:origin: FenixEdu/fenixedu-academic

private void encodeDaysOfWeek(ResponseWriter writer, Locale locale) throws IOException {
  writer.startElement("tr", this);
  SimpleDateFormat sdf = new SimpleDateFormat("dd/MM/yyyy HH:mm", locale);
  DateFormatSymbols dfs = sdf.getDateFormatSymbols();
  encodeDayOfWeek(writer, (dfs.getWeekdays())[Calendar.MONDAY]);
  encodeDayOfWeek(writer, (dfs.getWeekdays())[Calendar.TUESDAY]);
  encodeDayOfWeek(writer, (dfs.getWeekdays())[Calendar.WEDNESDAY]);
  encodeDayOfWeek(writer, (dfs.getWeekdays())[Calendar.THURSDAY]);
  encodeDayOfWeek(writer, (dfs.getWeekdays())[Calendar.FRIDAY]);
  encodeDayOfWeek(writer, (dfs.getWeekdays())[Calendar.SATURDAY]);
  writer.endElement("tr");
}

相关文章

SimpleDateFormat类方法