Example usage for org.joda.time.format DateTimeFormat shortDate

List of usage examples for org.joda.time.format DateTimeFormat shortDate

Introduction

In this page you can find the example usage for org.joda.time.format DateTimeFormat shortDate.

Prototype

public static DateTimeFormatter shortDate() 

Source Link

Document

Creates a format that outputs a short date format.

Usage

From source file:org.vaadin.addons.tuningdatefield.TuningDateField.java

License:Apache License

/**
 * Returns the {@link DateTimeFormatter} used.
 * //from  w  w w  . j a  v a2s  .  c o m
 * @return the {@link DateTimeFormatter} used.
 */
public DateTimeFormatter getDateTimeFormatter() {
    if (dateTimeFormatterPattern == null) {
        return DateTimeFormat.shortDate().withLocale(getLocale());
    } else {
        return DateTimeFormat.forPattern(dateTimeFormatterPattern).withLocale(getLocale());
    }
}

From source file:ro.activemall.photoxserver.utils.thymeleafJoda.JodaTimeDialect.java

License:Open Source License

@Override
public Set<IProcessor> getProcessors() {
    Set<IProcessor> processors = new HashSet<IProcessor>();
    processors.add(new JodaTimeFormatProcessor("fullDate", DateTimeFormat.fullDate()));
    processors.add(new JodaTimeFormatProcessor("fullDateTime", DateTimeFormat.fullDateTime()));
    processors.add(new JodaTimeFormatProcessor("fullTime", DateTimeFormat.fullTime()));
    processors.add(new JodaTimeFormatProcessor("longDate", DateTimeFormat.longDate()));
    processors.add(new JodaTimeFormatProcessor("longDateTime", DateTimeFormat.longDateTime()));
    processors.add(new JodaTimeFormatProcessor("longTime", DateTimeFormat.longTime()));
    processors.add(new JodaTimeFormatProcessor("mediumDate", DateTimeFormat.mediumDate()));
    processors.add(new JodaTimeFormatProcessor("mediumDateTime", DateTimeFormat.mediumDateTime()));
    processors.add(new JodaTimeFormatProcessor("mediumTime", DateTimeFormat.mediumTime()));
    processors.add(new JodaTimeFormatProcessor("shortDate", DateTimeFormat.shortDate()));
    processors.add(new JodaTimeFormatProcessor("shortDateTime", DateTimeFormat.shortDateTime()));
    processors.add(new JodaTimeFormatProcessor("shortTime", DateTimeFormat.shortTime()));
    processors.add(new JodaTimeFormatProcessor("isoDateTime", ISODateTimeFormat.dateTime()));
    return processors;
}

From source file:ro.activemall.photoxserver.utils.thymeleafJoda.JodaTimeExpressionObject.java

License:Open Source License

/**
 * Formats the datetime with a JodaTime short date format
 *
 * @param dateTime//  ww w  .j a  v  a2  s .  c om
 *            The datetime
 * @return The formatted date
 */
public String shortDate(DateTime dateTime) {
    return format(dateTime, DateTimeFormat.shortDate());
}

From source file:ru.caramel.juniperbot.core.message.resolver.DateTimePlaceholderResolver.java

License:Open Source License

@Override
public Object getChild(String name) {
    switch (name) {
    case "shortTime":
        return format(DateTimeFormat.shortTime());
    case "mediumTime":
        return format(DateTimeFormat.mediumTime());
    case "longTime":
        return format(DateTimeFormat.longTime());
    case "fullTime":
        return format(DateTimeFormat.fullTime());
    case "shortDate":
        return format(DateTimeFormat.shortDate());
    case "mediumDate":
        return format(DateTimeFormat.mediumDate());
    case "longDate":
        return format(DateTimeFormat.longDate()); // The same as medium
    case "fullDate":
        return format(DateTimeFormat.fullDate());
    case "shortDateTime":
        return format(DateTimeFormat.shortDateTime());
    case "mediumDateTime":
        return format(DateTimeFormat.mediumDateTime());
    case "longDateTime":
        return format(DateTimeFormat.longDateTime());
    case "fullDateTime":
        return format(DateTimeFormat.fullDateTime());
    }//from w  w w.  j  ava 2  s  .  c om
    return null;
}

From source file:uk.ac.cam.db538.cryptosms.ui.UtilsTextFormat.java

License:Apache License

/**
 * Format date time./*from www.ja  v  a  2s  . c o  m*/
 *
 * @param timeStamp the time stamp
 * @return the string
 */
public static String formatDateTime(DateTime timeStamp) {
    DateTime now = DateTime.now();
    if (timeStamp.toLocalDate().equals(now.toLocalDate()))
        // today => just time
        return timeStamp.toString(DateTimeFormat.shortTime());
    else
        // not today => just date
        return timeStamp.toString(DateTimeFormat.shortDate());
}