Example usage for java.text DateFormat SHORT

List of usage examples for java.text DateFormat SHORT

Introduction

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

Prototype

int SHORT

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

Click Source Link

Document

Constant for short style pattern.

Usage

From source file:org.mifos.framework.util.helpers.DateUtils.java

public static boolean isValidDate(String value) {
    try {//www .  j  av a2s  . c  o m
        SimpleDateFormat shortFormat = (SimpleDateFormat) DateFormat.getDateInstance(DateFormat.SHORT,
                internalLocale);
        shortFormat.setLenient(false);
        shortFormat.parse(value);
        return true;
    }

    catch (java.text.ParseException e) {
        return false;
    }
}

From source file:DDTDate.java

/**
 * This function will populate the varsMap with new copies of values related to display format of date & time stamps.
 * Those values are based on the class (static) date variable that is currently in use.
 * Those values can later be used in verification of UI elements that are date-originated but may change in time (say, today's date, month, year - etc.)
 * The base date that is used is Locale dependent (currently, the local is assumed to be that of the workstation running the software.)
 * When relevant, values are provided in various styles (SHORT, MEDIUM, LONG, FULL) - not all date elements have all those versions available.
 * The purpose of this 'exercise' is to set up the facility for the user to verify any component of date / time stamps independently of one another or 'traditional' formatting.
 *
 * The variables maintained here are formatted with a prefix to distinguish them from other, user defined variables.
 *
 * @TODO: enable Locale modifications (at present the test machine's locale is considered and within a test session only one locale can be tested)
 * @param varsMap/*from   w ww  .  j  a  va 2 s  . c o m*/
 */
private void maintainDateProperties(Hashtable<String, Object> varsMap) throws Exception {

    String prefix = "$";

    try {
        // Build formatting objects for each of the output styles
        DateFormat shortStyleFormatter = DateFormat.getDateInstance(DateFormat.SHORT);
        DateFormat mediumStyleFormatter = DateFormat.getDateInstance(DateFormat.MEDIUM);
        DateFormat longStyleFormatter = DateFormat.getDateInstance(DateFormat.LONG);
        DateFormat fullStyleFormatter = DateFormat.getDateInstance(DateFormat.FULL);

        // Use a dedicated variable to hold values of formatting results to facilitate debugging
        // @TODO (maybe) when done debugging - convert to inline calls to maintainDateProperty ...
        String formatValue;

        // Examples reflect time around midnight of February 6 2014 - actual values DO NOT include quotes (added here for readability)

        MutableDateTime theReferenceDate = getReferenceDate(); //getReferenceDateAdjustedForTimeZone();
        // Default Date using DDTSettings pattern.
        formatValue = new SimpleDateFormat(defaultDateFormat()).format(theReferenceDate.toDate());
        maintainDateProperty(prefix + "defaultDate", formatValue, varsMap);

        // Short Date - '2/6/14'
        formatValue = shortStyleFormatter.format(theReferenceDate.toDate());
        maintainDateProperty(prefix + "shortDate", formatValue, varsMap);

        // Medium Date - 'Feb 6, 2014'
        formatValue = mediumStyleFormatter.format(theReferenceDate.toDate());
        maintainDateProperty(prefix + "mediumDate", formatValue, varsMap);

        // Long Date - 'February 6, 2014'
        formatValue = longStyleFormatter.format(theReferenceDate.toDate());
        maintainDateProperty(prefix + "longDate", formatValue, varsMap);

        // Full Date 'Thursday, February 6, 2014'
        formatValue = fullStyleFormatter.format(theReferenceDate.toDate());
        maintainDateProperty(prefix + "fullDate", formatValue, varsMap);

        // hours : minutes : seconds : milliseconds (broken to separate components)  -
        formatValue = theReferenceDate.toString("hh:mm:ss:SSS");
        if (formatValue.toString().contains(":")) {
            String[] hms = split(formatValue.toString(), ":");
            if (hms.length > 3) {
                // Hours - '12'
                formatValue = hms[0];
                maintainDateProperty(prefix + "hours", formatValue, varsMap);
                // Minutes - '02'
                formatValue = hms[1];
                maintainDateProperty(prefix + "minutes", formatValue, varsMap);
                // Seconds - '08'
                formatValue = hms[2];
                maintainDateProperty(prefix + "seconds", formatValue, varsMap);
                // Milliseconds - '324'
                formatValue = hms[3];
                maintainDateProperty(prefix + "milliseconds", formatValue, varsMap);
                // Hours in 24 hours format - '23'
                formatValue = theReferenceDate.toString("HH");
                maintainDateProperty(prefix + "hours24", formatValue, varsMap);
            } else
                setException("Failed to format reference date to four time units!");
        } else {
            setException("Failed to format reference date to its time units!");
        }

        // hours : minutes : seconds (default timestamp)  - '12:34:56'
        formatValue = theReferenceDate.toString("hh:mm:ss");
        maintainDateProperty(prefix + "timeStamp", formatValue, varsMap);

        // Short Year - '14'
        formatValue = theReferenceDate.toString("yy");
        maintainDateProperty(prefix + "shortYear", formatValue, varsMap);

        // Long Year - '2014'
        formatValue = theReferenceDate.toString("yyyy");
        maintainDateProperty(prefix + "longYear", formatValue, varsMap);

        // Short Month - '2'
        formatValue = theReferenceDate.toString("M");
        maintainDateProperty(prefix + "shortMonth", formatValue, varsMap);

        // Padded Month - '02'
        formatValue = theReferenceDate.toString("MM");
        maintainDateProperty(prefix + "paddedMonth", formatValue, varsMap);

        // Short Month Name - 'Feb'
        formatValue = theReferenceDate.toString("MMM");
        maintainDateProperty(prefix + "shortMonthName", formatValue, varsMap);

        // Long Month Name - 'February'
        formatValue = theReferenceDate.toString("MMMM");
        maintainDateProperty(prefix + "longMonthName", formatValue, varsMap);

        // Week in Year - '2014' (the year in which this week falls)
        formatValue = String.valueOf(theReferenceDate.getWeekyear());
        maintainDateProperty(prefix + "weekYear", formatValue, varsMap);

        // Short Day in date stamp - '6'
        formatValue = theReferenceDate.toString("d");
        maintainDateProperty(prefix + "shortDay", formatValue, varsMap);

        // Padded Day in date stamp - possibly with leading 0 - '06'
        formatValue = theReferenceDate.toString("dd");
        maintainDateProperty(prefix + "paddedDay", formatValue, varsMap);

        // Day of Year - '37'
        formatValue = theReferenceDate.toString("D");
        maintainDateProperty(prefix + "yearDay", formatValue, varsMap);

        // Short Day Name - 'Thu'
        formatValue = theReferenceDate.toString("E");
        maintainDateProperty(prefix + "shortDayName", formatValue, varsMap);

        // Long Day Name - 'Thursday'
        DateTime dt = new DateTime(theReferenceDate.toDate());
        DateTime.Property dowDTP = dt.dayOfWeek();
        formatValue = dowDTP.getAsText();
        maintainDateProperty(prefix + "longDayName", formatValue, varsMap);

        // AM/PM - 'AM'
        formatValue = theReferenceDate.toString("a");
        maintainDateProperty(prefix + "ampm", formatValue, varsMap);

        // Era - (BC/AD)
        formatValue = theReferenceDate.toString("G");
        maintainDateProperty(prefix + "era", formatValue, varsMap);

        // Time Zone - 'EST'
        formatValue = theReferenceDate.toString("zzz");
        maintainDateProperty(prefix + "zone", formatValue, varsMap);

        addComment(
                "Date variables replenished for date: " + fullStyleFormatter.format(theReferenceDate.toDate()));
        addComment(theReferenceDate.toString());
        System.out.println(getComments());
    } catch (Exception e) {
        setException(e);
    }
}

From source file:com.appeligo.search.actions.account.BaseAccountAction.java

public void setLatestSmsTime(String latestSmsTime) {
    DateFormat format = SimpleDateFormat.getTimeInstance(DateFormat.SHORT);
    try {/*  w ww .  ja  v  a 2 s  .  co m*/
        this.latestSmsTime = new Time(format.parse(latestSmsTime).getTime());
    } catch (ParseException e) {
        log.error("Format from account_macros.vm was wrong", e);
    }
}

From source file:org.opencms.workplace.comparison.CmsElementComparisonList.java

/**
 * @see org.opencms.workplace.list.A_CmsListDialog#getListItems()
 *//*  w ww . jav a2 s.  com*/
protected List getListItems() throws CmsException {

    List result = new ArrayList();
    CmsFile resource1 = CmsResourceComparisonDialog.readFile(getCms(), new CmsUUID(getParamId1()),
            getParamVersion1());
    CmsFile resource2 = CmsResourceComparisonDialog.readFile(getCms(), new CmsUUID(getParamId2()),
            getParamVersion2());
    Iterator diffs = new CmsXmlDocumentComparison(getCms(), resource1, resource2).getElements().iterator();
    while (diffs.hasNext()) {
        CmsElementComparison comparison = (CmsElementComparison) diffs.next();
        String locale = comparison.getLocale().toString();
        String attribute = comparison.getName();
        CmsListItem item = getList().newItem(locale + attribute);
        item.set(LIST_COLUMN_LOCALE, locale);
        item.set(LIST_COLUMN_ATTRIBUTE, attribute);
        if (comparison instanceof CmsXmlContentElementComparison) {
            m_xmlContentComparisonMode = true;
            item.set(LIST_COLUMN_TYPE, ((CmsXmlContentElementComparison) comparison).getType());
        }
        if (CmsResourceComparison.TYPE_ADDED.equals(comparison.getStatus())) {
            item.set(LIST_COLUMN_STATUS, key(Messages.GUI_COMPARE_ADDED_0));
        } else if (CmsResourceComparison.TYPE_REMOVED.equals(comparison.getStatus())) {
            item.set(LIST_COLUMN_STATUS, key(Messages.GUI_COMPARE_REMOVED_0));
        } else if (CmsResourceComparison.TYPE_CHANGED.equals(comparison.getStatus())) {
            item.set(LIST_COLUMN_STATUS, key(Messages.GUI_COMPARE_CHANGED_0));
        } else {
            if (!getList().getMetadata().getItemDetailDefinition(LIST_IACTION_SHOW).isVisible()) {
                // do not display entry
                continue;
            } else {
                item.set(LIST_COLUMN_STATUS, key(Messages.GUI_COMPARE_UNCHANGED_0));
            }
        }
        String value1 = CmsStringUtil.escapeHtml(CmsStringUtil.substitute(
                CmsStringUtil.trimToSize(comparison.getVersion1(), CmsPropertyComparisonList.TRIM_AT_LENGTH),
                "\n", ""));

        // formatting DateTime
        if (comparison instanceof CmsXmlContentElementComparison) {
            if (((CmsXmlContentElementComparison) comparison).getType().equals(CmsXmlDateTimeValue.TYPE_NAME)) {
                if (CmsStringUtil.isNotEmpty(value1)) {
                    value1 = CmsDateUtil.getDateTime(new Date(Long.parseLong(value1)), DateFormat.SHORT,
                            getCms().getRequestContext().getLocale());
                }
            }
        }
        item.set(LIST_COLUMN_VERSION_1, value1);

        String value2 = CmsStringUtil.escapeHtml(CmsStringUtil.substitute(
                CmsStringUtil.trimToSize(comparison.getVersion2(), CmsPropertyComparisonList.TRIM_AT_LENGTH),
                "\n", ""));

        // formatting DateTime
        if (comparison instanceof CmsXmlContentElementComparison) {
            if (((CmsXmlContentElementComparison) comparison).getType().equals(CmsXmlDateTimeValue.TYPE_NAME)) {
                if (CmsStringUtil.isNotEmpty(value2)) {

                    value2 = CmsDateUtil.getDateTime(new Date(Long.parseLong(value2)), DateFormat.SHORT,
                            getCms().getRequestContext().getLocale());
                }
            }
        }
        item.set(LIST_COLUMN_VERSION_2, value2);
        result.add(item);
    }

    getList().getMetadata().getColumnDefinition(LIST_COLUMN_VERSION_1).setName(Messages.get().container(
            Messages.GUI_COMPARE_VERSION_1, CmsHistoryList.getDisplayVersion(getParamVersion1(), getLocale())));
    getList().getMetadata().getColumnDefinition(LIST_COLUMN_VERSION_2).setName(Messages.get().container(
            Messages.GUI_COMPARE_VERSION_1, CmsHistoryList.getDisplayVersion(getParamVersion2(), getLocale())));
    return result;
}

From source file:org.openregistry.core.service.DefaultPersonServiceIntegrationTests.java

/**
 * Test 3: Test of adding two new Sor Persons where there is an exact match (same SoR)
 *
 * This is an update.  TODO complete this test
 *///from  w ww  . j  a  v a  2s  .com
@Test(expected = SorPersonAlreadyExistsException.class)
@Rollback
public void testAddExactPersonWithSameSoR() throws ReconciliationException, SorPersonAlreadyExistsException {
    final ReconciliationCriteria reconciliationCriteria = constructReconciliationCriteria(RUDYARD, KIPLING,
            null, EMAIL_ADDRESS, PHONE_NUMBER, new Date(0), OR_WEBAPP_IDENTIFIER, null);
    final ServiceExecutionResult<Person> result = this.personService.addPerson(reconciliationCriteria);
    final Person person = result.getTargetObject();

    assertTrue(result.succeeded());
    assertNotNull(result.getTargetObject().getId());
    assertEquals(1, countRowsInTable("prc_persons"));
    assertEquals(1, countRowsInTable("prc_names"));
    assertEquals(1, countRowsInTable("prs_names"));
    assertEquals(1, countRowsInTable("prs_sor_persons"));

    final SorPerson sorPerson = this.personService.findByPersonIdAndSorIdentifier(person.getId(),
            reconciliationCriteria.getSorPerson().getSourceSor());

    // check birthdate is set correctly
    Date birthDate = this.simpleJdbcTemplate
            .queryForObject("select date_of_birth from prc_persons where id = ?", Date.class, person.getId());
    DateFormat formatter = DateFormat.getDateInstance(DateFormat.SHORT);
    assertEquals(formatter.format(birthDate), formatter.format(person.getDateOfBirth()));

    // check SOR source is set correctly
    String sourceSor = this.simpleJdbcTemplate.queryForObject(
            "select source_sor_id from prs_sor_persons where person_id = ?", String.class, person.getId());
    assertEquals(sourceSor, sorPerson.getSourceSor());

    // check names in prc_names
    String familyName = this.simpleJdbcTemplate.queryForObject(
            "select family_name from prc_names where person_id = ?", String.class, person.getId());
    assertEquals(familyName, KIPLING);

    String givenName = this.simpleJdbcTemplate.queryForObject(
            "select given_name from prc_names where person_id = ?", String.class, person.getId());
    assertEquals(givenName, RUDYARD);

    // check names in prs_names
    String prsFamilyName = this.simpleJdbcTemplate.queryForObject(
            "select family_name from prs_names where sor_person_id = ?", String.class, sorPerson.getId());
    assertEquals(prsFamilyName, KIPLING);

    String prsGivenName = this.simpleJdbcTemplate.queryForObject(
            "select given_name from prs_names where sor_person_id = ?", String.class, sorPerson.getId());
    assertEquals(prsGivenName, RUDYARD);

    this.personService.addPerson(reconciliationCriteria);
}

From source file:org.webguitoolkit.ui.controls.form.Text.java

/**
 * This method determines the time mode.<br>
 * It is checked if a 24 or a 12 (am/pm) hour mode is used by the locale
 * //from   w  ww.jav  a 2 s  . c  o  m
 * @return true if the hour mode is 24
 */
private boolean is24HourMode() {
    // A bit a dirty way to check the hour mode...a Date is converted an checked...
    DateFormat df = DateFormat.getDateTimeInstance(DateFormat.SHORT, DateFormat.SHORT, TextService.getLocale());
    String testDate = df.format(new Date());
    if (StringUtils.containsIgnoreCase(testDate, "am") || StringUtils.containsIgnoreCase(testDate, "pm")) {
        return false;
    } else {
        return true;
    }
}

From source file:org.y20k.trackbook.MainActivityTrackFragment.java

private void displayTrack() {
    GeoPoint position;//w w w  . java 2 s  . c om

    if (mTrack != null) {
        // set end of track as position
        Location lastLocation = mTrack.getWayPointLocation(mTrack.getSize() - 1);
        position = new GeoPoint(lastLocation.getLatitude(), lastLocation.getLongitude());

        String recordingStart = DateFormat.getDateInstance(DateFormat.SHORT, Locale.getDefault())
                .format(mTrack.getRecordingStart()) + " "
                + DateFormat.getTimeInstance(DateFormat.SHORT, Locale.getDefault())
                        .format(mTrack.getRecordingStart());
        String recordingStop = DateFormat.getDateInstance(DateFormat.SHORT, Locale.getDefault())
                .format(mTrack.getRecordingStop()) + " "
                + DateFormat.getTimeInstance(DateFormat.SHORT, Locale.getDefault())
                        .format(mTrack.getRecordingStop());

        // populate views
        mDistanceView.setText(mTrack.getTrackDistance());
        mStepsView.setText(String.valueOf(Math.round(mTrack.getStepCount())));
        mWaypointsView.setText(String.valueOf(mTrack.getWayPoints().size()));
        mDurationView.setText(mTrack.getTrackDuration());
        mRecordingStartView.setText(recordingStart);
        mRecordingStopView.setText(recordingStop);

        // draw track on map
        drawTrackOverlay(mTrack);
    } else {
        position = new GeoPoint(DEFAULT_LATITUDE, DEFAULT_LONGITUDE);
    }

    // center map over position
    mController.setCenter(position);

}

From source file:com.opensymphony.xwork2.conversion.impl.XWorkBasicConverter.java

private Object doConvertToDate(Map<String, Object> context, Object value, Class toType) {
    Date result = null;/*from   ww  w  .  ja  v a  2s.  c o m*/

    if (value instanceof String && value != null && ((String) value).length() > 0) {
        String sa = (String) value;
        Locale locale = getLocale(context);

        DateFormat df = null;
        if (java.sql.Time.class == toType) {
            df = DateFormat.getTimeInstance(DateFormat.MEDIUM, locale);
        } else if (java.sql.Timestamp.class == toType) {
            Date check = null;
            SimpleDateFormat dtfmt = (SimpleDateFormat) DateFormat.getDateTimeInstance(DateFormat.SHORT,
                    DateFormat.MEDIUM, locale);
            SimpleDateFormat fullfmt = new SimpleDateFormat(dtfmt.toPattern() + MILLISECOND_FORMAT, locale);

            SimpleDateFormat dfmt = (SimpleDateFormat) DateFormat.getDateInstance(DateFormat.SHORT, locale);

            SimpleDateFormat[] fmts = { fullfmt, dtfmt, dfmt };
            for (SimpleDateFormat fmt : fmts) {
                try {
                    check = fmt.parse(sa);
                    df = fmt;
                    if (check != null) {
                        break;
                    }
                } catch (ParseException ignore) {
                }
            }
        } else if (java.util.Date.class == toType) {
            Date check = null;
            DateFormat[] dfs = getDateFormats(locale);
            for (DateFormat df1 : dfs) {
                try {
                    check = df1.parse(sa);
                    df = df1;
                    if (check != null) {
                        break;
                    }
                } catch (ParseException ignore) {
                }
            }
        }
        //final fallback for dates without time
        if (df == null) {
            df = DateFormat.getDateInstance(DateFormat.SHORT, locale);
        }
        try {
            df.setLenient(false); // let's use strict parsing (XW-341)
            result = df.parse(sa);
            if (!(Date.class == toType)) {
                try {
                    Constructor constructor = toType.getConstructor(new Class[] { long.class });
                    return constructor.newInstance(new Object[] { Long.valueOf(result.getTime()) });
                } catch (Exception e) {
                    throw new XWorkException(
                            "Couldn't create class " + toType + " using default (long) constructor", e);
                }
            }
        } catch (ParseException e) {
            throw new XWorkException("Could not parse date", e);
        }
    } else if (Date.class.isAssignableFrom(value.getClass())) {
        result = (Date) value;
    }
    return result;
}

From source file:org.parakoopa.gmnetgate.punch.Mediator.java

/**
 * Logs to the console (if quiet was not set) and to the logfile if
 * specified The logfile will also get timestamps for each event.
 *
 * @param str String to log//from ww w .  j  a va 2  s  .c  o m
 * @param verbose boolean Should this be logged only with --verbose?
 */
public static void log(String str, boolean verbose) {
    //Don't print verbose lines if not requested
    if (verbose && !Mediator.verbose) {
        return;
    }
    DateFormat date = DateFormat.getDateTimeInstance(DateFormat.SHORT, DateFormat.SHORT, Locale.getDefault());
    /* CONSOLE OUTPUT */
    if (!Mediator.quiet) {
        System.out.println(date.format(new Date()) + " : " + str);
    }
    /* FILE LOG */
    if (Mediator.log != null) {
        try (PrintWriter out = new PrintWriter(new BufferedWriter(new FileWriter(Mediator.log, true)))) {
            out.println(date.format(new Date()) + " : " + str);
        } catch (IOException ex) {
            Logger.getLogger(Mediator.class.getName()).log(Level.SEVERE, null, ex);
        }
    }
}

From source file:org.jivesoftware.openfire.reporting.graph.GraphEngine.java

private TickUnits createTickUnits(Locale locale, TimeZone zone) {
    TickUnits units = new TickUnits();

    // date formatters
    DateFormat f1 = new SimpleDateFormat("HH:mm:ss.SSS", locale);
    DateFormat f2 = new SimpleDateFormat("HH:mm:ss", locale);
    DateFormat f3 = DateFormat.getTimeInstance(DateFormat.SHORT, locale);
    DateFormat f4 = DateFormat.getDateTimeInstance(DateFormat.SHORT, DateFormat.SHORT, locale);
    DateFormat f5 = new SimpleDateFormat("d-MMM", locale);
    DateFormat f6 = new SimpleDateFormat("MMM-yyyy", locale);
    DateFormat f7 = new SimpleDateFormat("yyyy", locale);

    // NOTE: timezone not needed on date formatters because dates have already been converted
    // to the appropriate timezone by the respective RegularTimePeriod (Minute, Hour, Day, etc)
    // see:/*from  ww w.  j  a  v  a 2s.c o  m*/
    //   http://www.jfree.org/jfreechart/api/gjdoc/org/jfree/data/time/Hour.html#Hour:Date:TimeZone
    //
    // If you do use a timezone on the formatters and the Jive TimeZone has been set to something
    // other than the system timezone, time specific charts will show incorrect values.
    /*
    f1.setTimeZone(zone);
    f2.setTimeZone(zone);
    f3.setTimeZone(zone);
    f4.setTimeZone(zone);
    f5.setTimeZone(zone);
    f6.setTimeZone(zone);
    f7.setTimeZone(zone);
    */

    // milliseconds
    units.add(new DateTickUnit(DateTickUnit.MILLISECOND, 1, f1));
    units.add(new DateTickUnit(DateTickUnit.MILLISECOND, 5, DateTickUnit.MILLISECOND, 1, f1));
    units.add(new DateTickUnit(DateTickUnit.MILLISECOND, 10, DateTickUnit.MILLISECOND, 1, f1));
    units.add(new DateTickUnit(DateTickUnit.MILLISECOND, 25, DateTickUnit.MILLISECOND, 5, f1));
    units.add(new DateTickUnit(DateTickUnit.MILLISECOND, 50, DateTickUnit.MILLISECOND, 10, f1));
    units.add(new DateTickUnit(DateTickUnit.MILLISECOND, 100, DateTickUnit.MILLISECOND, 10, f1));
    units.add(new DateTickUnit(DateTickUnit.MILLISECOND, 250, DateTickUnit.MILLISECOND, 10, f1));
    units.add(new DateTickUnit(DateTickUnit.MILLISECOND, 500, DateTickUnit.MILLISECOND, 50, f1));

    // seconds
    units.add(new DateTickUnit(DateTickUnit.SECOND, 1, DateTickUnit.MILLISECOND, 50, f2));
    units.add(new DateTickUnit(DateTickUnit.SECOND, 5, DateTickUnit.SECOND, 1, f2));
    units.add(new DateTickUnit(DateTickUnit.SECOND, 10, DateTickUnit.SECOND, 1, f2));
    units.add(new DateTickUnit(DateTickUnit.SECOND, 30, DateTickUnit.SECOND, 5, f2));

    // minutes
    units.add(new DateTickUnit(DateTickUnit.MINUTE, 1, DateTickUnit.SECOND, 5, f3));
    units.add(new DateTickUnit(DateTickUnit.MINUTE, 2, DateTickUnit.SECOND, 10, f3));
    units.add(new DateTickUnit(DateTickUnit.MINUTE, 5, DateTickUnit.MINUTE, 1, f3));
    units.add(new DateTickUnit(DateTickUnit.MINUTE, 10, DateTickUnit.MINUTE, 1, f3));
    units.add(new DateTickUnit(DateTickUnit.MINUTE, 15, DateTickUnit.MINUTE, 5, f3));
    units.add(new DateTickUnit(DateTickUnit.MINUTE, 20, DateTickUnit.MINUTE, 5, f3));
    units.add(new DateTickUnit(DateTickUnit.MINUTE, 30, DateTickUnit.MINUTE, 5, f3));

    // hours
    units.add(new DateTickUnit(DateTickUnit.HOUR, 1, DateTickUnit.MINUTE, 5, f3));
    units.add(new DateTickUnit(DateTickUnit.HOUR, 2, DateTickUnit.MINUTE, 10, f3));
    units.add(new DateTickUnit(DateTickUnit.HOUR, 4, DateTickUnit.MINUTE, 30, f3));
    units.add(new DateTickUnit(DateTickUnit.HOUR, 6, DateTickUnit.HOUR, 1, f3));
    units.add(new DateTickUnit(DateTickUnit.HOUR, 12, DateTickUnit.HOUR, 1, f4));

    // days
    units.add(new DateTickUnit(DateTickUnit.DAY, 1, DateTickUnit.HOUR, 1, f5));
    units.add(new DateTickUnit(DateTickUnit.DAY, 2, DateTickUnit.HOUR, 1, f5));
    units.add(new DateTickUnit(DateTickUnit.DAY, 7, DateTickUnit.DAY, 1, f5));
    units.add(new DateTickUnit(DateTickUnit.DAY, 15, DateTickUnit.DAY, 1, f5));

    // months
    units.add(new DateTickUnit(DateTickUnit.MONTH, 1, DateTickUnit.DAY, 1, f6));
    units.add(new DateTickUnit(DateTickUnit.MONTH, 2, DateTickUnit.DAY, 1, f6));
    units.add(new DateTickUnit(DateTickUnit.MONTH, 3, DateTickUnit.MONTH, 1, f6));
    units.add(new DateTickUnit(DateTickUnit.MONTH, 4, DateTickUnit.MONTH, 1, f6));
    units.add(new DateTickUnit(DateTickUnit.MONTH, 6, DateTickUnit.MONTH, 1, f6));

    // years
    units.add(new DateTickUnit(DateTickUnit.YEAR, 1, DateTickUnit.MONTH, 1, f7));
    units.add(new DateTickUnit(DateTickUnit.YEAR, 2, DateTickUnit.MONTH, 3, f7));
    units.add(new DateTickUnit(DateTickUnit.YEAR, 5, DateTickUnit.YEAR, 1, f7));
    units.add(new DateTickUnit(DateTickUnit.YEAR, 10, DateTickUnit.YEAR, 1, f7));
    units.add(new DateTickUnit(DateTickUnit.YEAR, 25, DateTickUnit.YEAR, 5, f7));
    units.add(new DateTickUnit(DateTickUnit.YEAR, 50, DateTickUnit.YEAR, 10, f7));
    units.add(new DateTickUnit(DateTickUnit.YEAR, 100, DateTickUnit.YEAR, 20, f7));

    return units;
}