Java Code Examples for org.joda.time.format.DateTimeFormat#shortTime()

The following examples show how to use org.joda.time.format.DateTimeFormat#shortTime() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: TimeUtil.java    From sakai with Educational Community License v2.0 6 votes vote down vote up
public String getIsoDateWithLocalTime(Date dateToConvert) {
    if (dateToConvert == null) {
        return null;
    }
    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());

    // If the client browser is in a different timezone than server, need to modify date
    if (m_client_timezone !=null && m_server_timezone!=null && !m_client_timezone.hasSameRules(m_server_timezone)) {
      DateTimeZone dateTimeZone = DateTimeZone.forTimeZone(m_client_timezone);
      localFmt = localFmt.withZone(dateTimeZone);
      localFmtTime = localFmtTime.withZone(dateTimeZone);
    }
    return dt.toString(localFmt) + " " + dt.toString(localFmtTime);
}
 
Example 2
Source File: TimeUtil.java    From sakai with Educational Community License v2.0 6 votes vote down vote up
public String getIsoDateWithLocalTime(Date dateToConvert) {
    if (dateToConvert == null) {
        return null;
    }
    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());

    // If the client browser is in a different timezone than server, need to modify date
    if (m_client_timezone !=null && m_server_timezone!=null && !m_client_timezone.hasSameRules(m_server_timezone)) {
      DateTimeZone dateTimeZone = DateTimeZone.forTimeZone(m_client_timezone);
      localFmt = localFmt.withZone(dateTimeZone);
      localFmtTime = localFmtTime.withZone(dateTimeZone);
    }
    return dt.toString(localFmt) + " " + dt.toString(localFmtTime);
}
 
Example 3
Source File: JodaTimeFormatterRegistrar.java    From spring-analysis-note with MIT License 5 votes vote down vote up
private DateTimeFormatter getFallbackFormatter(Type type) {
	switch (type) {
		case DATE: return DateTimeFormat.shortDate();
		case TIME: return DateTimeFormat.shortTime();
		default: return DateTimeFormat.shortDateTime();
	}
}
 
Example 4
Source File: JodaTimeFormatterRegistrar.java    From java-technology-stack with MIT License 5 votes vote down vote up
private DateTimeFormatter getFallbackFormatter(Type type) {
	switch (type) {
		case DATE: return DateTimeFormat.shortDate();
		case TIME: return DateTimeFormat.shortTime();
		default: return DateTimeFormat.shortDateTime();
	}
}
 
Example 5
Source File: JodaTimeFormatterRegistrar.java    From lams with GNU General Public License v2.0 5 votes vote down vote up
private DateTimeFormatter getFallbackFormatter(Type type) {
	switch (type) {
		case DATE: return DateTimeFormat.shortDate();
		case TIME: return DateTimeFormat.shortTime();
		default: return DateTimeFormat.shortDateTime();
	}
}
 
Example 6
Source File: JodaTimeFormatterRegistrar.java    From spring4-understanding with Apache License 2.0 5 votes vote down vote up
private DateTimeFormatter getFallbackFormatter(Type type) {
	switch (type) {
		case DATE: return DateTimeFormat.shortDate();
		case TIME: return DateTimeFormat.shortTime();
		default: return DateTimeFormat.shortDateTime();
	}
}