Example usage for java.text DateFormat FULL

List of usage examples for java.text DateFormat FULL

Introduction

In this page you can find the example usage for java.text DateFormat FULL.

Prototype

int FULL

To view the source code for java.text DateFormat FULL.

Click Source Link

Document

Constant for full style pattern.

Usage

From source file:lucee.commons.i18n.FormatUtil.java

public static DateFormat[] getDateFormats(Locale locale, TimeZone tz, boolean lenient) {
    String id = "d-" + locale.hashCode() + "-" + tz.getID() + "-" + lenient;
    DateFormat[] df = formats.get(id);
    if (df == null) {
        List<DateFormat> list = new ArrayList<DateFormat>();
        list.add(DateFormat.getDateInstance(DateFormat.FULL, locale));
        list.add(DateFormat.getDateInstance(DateFormat.LONG, locale));
        list.add(DateFormat.getDateInstance(DateFormat.MEDIUM, locale));
        list.add(DateFormat.getDateInstance(DateFormat.SHORT, locale));
        addCustom(list, locale, FORMAT_TYPE_DATE);
        df = list.toArray(new DateFormat[list.size()]);

        for (int i = 0; i < df.length; i++) {
            df[i].setLenient(lenient);/*from  ww  w  . ja v  a  2s.co m*/
            df[i].setTimeZone(tz);
        }
        formats.put(id, df);
    }
    return df;
}

From source file:com.buddycloud.mediaserver.MediaServerTest.java

@Before
public void setUp() throws Exception {
    configuration = MediaServerConfiguration.getInstance().getConfiguration();
    configuration.setProperty(MediaServerConfiguration.MEDIA_STORAGE_ROOT_PROPERTY, TEST_MEDIA_STORAGE_ROOT);

    dataSource = new MetaDataSource();
    gson = new GsonBuilder().setDateFormat(DateFormat.FULL, DateFormat.FULL).create();

    start();//ww  w  .j  a  v  a  2  s . c  o m
    testSetUp();

    Thread.sleep(1000);
}

From source file:de.taimos.gpsd4java.backend.AbstractResultParser.java

protected double parseTimestamp(final JSONObject json, final String fieldName) {
    try {//from ww  w.  j  a v  a 2s . c  o m
        final String text = json.optString(fieldName, null);
        AbstractResultParser.LOG.debug(fieldName + ": {}", text);

        if (text != null) {
            final Date date = this.dateFormat.parse(text);
            if (AbstractResultParser.LOG.isDebugEnabled()) {
                final String ds = DateFormat.getDateTimeInstance(DateFormat.FULL, DateFormat.FULL).format(date);
                AbstractResultParser.LOG.debug("Date: {}", ds);
            }
            return date.getTime() / 1000.0;
        }
    } catch (final Exception ex) {
        AbstractResultParser.LOG.info("Failed to parse time", ex);
    }
    return Double.NaN;
}

From source file:DateTimeEditor.java

public DateTimeEditor(int timeOrDateType) {
    m_timeOrDateType = timeOrDateType;
    m_lengthStyle = DateFormat.FULL;
    init();
}

From source file:org.codekaizen.vtj.text.BpDateFormatTest.java

/**
 * DOCUMENT ME!/*  w  ww .  j a  v a2 s .  c o m*/
 */
public void testFormatting() {
    DateFormat fmt1 = null;
    DateFormat fmt2 = null;
    Date date = null;
    String s1 = null;
    String s2 = null;

    date = new Date();

    fmt1 = new BpDateFormat(BpDateFormat.JVM_DATE_TIME, null);
    fmt2 = DateFormat.getDateTimeInstance();
    s1 = fmt1.format(date);
    s2 = fmt2.format(date);
    assertEquals(s2, s1);

    fmt1 = new BpDateFormat(BpDateFormat.JVM_DATE_ONLY, null);
    fmt2 = DateFormat.getDateInstance(DateFormat.SHORT);
    s1 = fmt1.format(date);
    s2 = fmt2.format(date);
    assertEquals(s2, s1);

    fmt1 = new BpDateFormat(BpDateFormat.JVM_TIME_ONLY, null);
    fmt2 = DateFormat.getTimeInstance(DateFormat.SHORT);
    s1 = fmt1.format(date);
    s2 = fmt2.format(date);
    assertEquals(s2, s1);

    fmt1 = new BpDateFormat(BpDateFormat.JVM_FULL_DATE, null);
    fmt2 = DateFormat.getDateInstance(DateFormat.FULL);
    s1 = fmt1.format(date);
    s2 = fmt2.format(date);
    assertEquals(s2, s1);

    fmt1 = new BpDateFormat(BpDateFormat.JVM_DATE_TIME, Locale.CANADA_FRENCH);
    fmt2 = DateFormat.getDateTimeInstance(DateFormat.SHORT, DateFormat.SHORT, Locale.CANADA_FRENCH);
    s1 = fmt1.format(date);
    s2 = fmt2.format(date);
    assertEquals(s2, s1);

}

From source file:org.olat.core.util.StringHelper.java

/**
 * @param date/* w ww. jav a 2s.  co  m*/
 * @param locale
 * @return formatted date
 */
public static String formatLocaleDateFull(long date, Locale locale) {
    if (date == -1)
        return "-";
    return DateFormat.getDateInstance(DateFormat.FULL, locale).format(new Date(date));
}

From source file:de.uniwue.info6.webapp.admin.SubmissionRow.java

public String getEntryDate() {
    if (userEntry != null) {
        DateFormat df = DateFormat.getDateTimeInstance(DateFormat.LONG, DateFormat.FULL,
                new Locale("de", "DE"));
        return df.format(userEntry.getEntryTime());
    }/*  w  ww  .  java2 s .c o  m*/
    return "---";
}

From source file:com.buddycloud.mediaserver.business.dao.MediaDAO.java

protected MediaDAO() {
    this.dataSource = new MetaDataSource();
    this.pubsub = XMPPToolBox.getInstance().getPubSubClient();
    this.gson = new GsonBuilder().setDateFormat(DateFormat.FULL, DateFormat.FULL).create();
    this.configuration = MediaServerConfiguration.getInstance().getConfiguration();
}

From source file:org.olat.core.util.StringHelper.java

/**
 * //from   ww  w. ja va  2  s.  c o m
 * @param date
 * @param locale
 * @return Formatted date
 */
public static String formatLocaleDateFull(Date date, Locale locale) {
    if (date == null)
        return "-";
    return DateFormat.getDateInstance(DateFormat.FULL, locale).format(date);
}

From source file:lucee.commons.i18n.FormatUtil.java

public static DateFormat[] getTimeFormats(Locale locale, TimeZone tz, boolean lenient) {
    String id = "t-" + locale.hashCode() + "-" + tz.getID() + "-" + lenient;
    DateFormat[] df = formats.get(id);
    if (df == null) {
        List<DateFormat> list = new ArrayList<DateFormat>();
        list.add(DateFormat.getTimeInstance(DateFormat.FULL, locale));
        list.add(DateFormat.getTimeInstance(DateFormat.LONG, locale));
        list.add(DateFormat.getTimeInstance(DateFormat.MEDIUM, locale));
        list.add(DateFormat.getTimeInstance(DateFormat.SHORT, locale));
        add24(list, locale);//w  w w.  j  a va 2  s . c om
        addCustom(list, locale, FORMAT_TYPE_TIME);
        df = list.toArray(new DateFormat[list.size()]);

        for (int i = 0; i < df.length; i++) {
            df[i].setLenient(lenient);
            df[i].setTimeZone(tz);
        }
        formats.put(id, df);
    }
    return df;
}