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

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

Introduction

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

Prototype

public static DateTimeFormatter shortTime() 

Source Link

Document

Creates a format that outputs a short time format.

Usage

From source file:org.apache.isis.applib.value.Time.java

License:Apache License

public String titleString() {
    return (time == null) ? "" : DateTimeFormat.shortTime().print(time);
}

From source file:org.gdg.frisbee.android.event.EventOverviewFragment.java

License:Apache License

private String formatTime(EventFullDetails eventFullDetails) {
    DateTimeFormatter fmt = DateTimeFormat.shortTime();
    return fmt.print(eventFullDetails.getStart());
}

From source file:org.sakaiproject.tool.assessment.ui.listener.util.TimeUtil.java

License:Educational Community License

public String getIsoDateWithLocalTime(Date dateToConvert) {
    DateTime dt = new DateTime(dateToConvert);
    DateTimeFormatter fmt = ISODateTimeFormat.yearMonthDay();
    DateTimeFormatter localFmt = fmt.withLocale(new ResourceLoader().getLocale());
    DateTimeFormatter fmtTime = DateTimeFormat.shortTime();
    DateTimeFormatter localFmtTime = fmtTime.withLocale(new ResourceLoader().getLocale());
    return dt.toString(localFmt) + " " + dt.toString(localFmtTime);
}

From source file:org.springframework.format.datetime.joda.JodaTimeFormatterRegistrar.java

License:Apache License

private DateTimeFormatter getFallbackFormatter(Type type) {
    switch (type) {
    case DATE:/*from   w ww. j  a  va  2s .c o  m*/
        return DateTimeFormat.shortDate();
    case TIME:
        return DateTimeFormat.shortTime();
    default:
        return DateTimeFormat.shortDateTime();
    }
}

From source file:org.springframework.format.datetime.joda.JodaTimeFormattingConfigurer.java

License:Apache License

private DateTimeFormatter getJodaTimeFormatter() {
    if (this.useIsoFormat) {
        return ISODateTimeFormat.time();
    }// w  w  w .ja va 2s  .co  m
    if (this.timeStyle != null) {
        return DateTimeFormat.forStyle("-" + this.timeStyle);
    } else {
        return DateTimeFormat.shortTime();
    }
}

From source file:org.vaadin.addons.javaee.fields.converter.StringToLocalTimeConverter.java

License:Apache License

@Override
public String convertToPresentation(LocalTime value, Class<? extends String> targetType, Locale locale)
        throws Converter.ConversionException {
    if (value == null) {
        return null;
    }//from  w  w  w  . j  a v  a2s .c  om
    return DateTimeFormat.shortTime().print(value);
}

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 time format
 *
 * @param dateTime// w ww  .j  a  va2  s  . co m
 *            The datetime
 * @return The formatted date
 */
public String shortTime(DateTime dateTime) {
    return format(dateTime, DateTimeFormat.shortTime());
}

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 www . j a  v  a 2s . c o m*/
    return null;
}

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

License:Apache License

/**
 * Format date time./*from w  w  w .  j a v  a2s  . co 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());
}