Examples of DateTimeFormatter


Examples of org.joda.time.format.DateTimeFormatter

   *      java.util.Locale)
   */
  public String convertToString(Date value, Locale locale)
  {
    DateTime dt = new DateTime((value).getTime(), getTimeZone());
    DateTimeFormatter format = getFormat(locale);

    if (applyTimeZoneDifference)
    {
      TimeZone zone = getClientTimeZone();
      if (zone != null)
      {
        // apply time zone to formatter
        format = format.withZone(DateTimeZone.forTimeZone(zone));
      }
    }
    return format.print(dt);
  }
View Full Code Here

Examples of org.joda.time.format.DateTimeFormatter

    List<DateTimeFormatter> formatters = DateTimeFormat.forPatterns(formats, timeZone, false);
   
    PosixLtVector.Builder result = new PosixLtVector.Builder();
    int resultLength = Math.max(x.length(), formats.length());
    for(int i=0;i!=resultLength;++i) {
      DateTimeFormatter formatter = formatters.get(i % formatters.size());
      String string = x.getElementAsString(i % x.length());
      try {
        result.add(parseIgnoreTrailingCharacters(formatter, string));
      } catch(IllegalArgumentException e) {
        result.addNA();
View Full Code Here

Examples of org.joda.time.format.DateTimeFormatter

   
    StringVector.Builder result = new StringVector.Builder();
    int resultLength = Math.max(dateTimes.length(), patterns.length());

    for(int i=0;i!=resultLength;++i) {
      DateTimeFormatter formatter = formatters.get(i % formatters.size());
      DateTime dateTime = dateTimes.getElementAsDateTime(i % dateTimes.length());
     
      result.add(formatter.print(dateTime));
    }
   
    return result.build();
  }
View Full Code Here

Examples of org.joda.time.format.DateTimeFormatter

    verifyFormat("2009-07-01 00:00:00", "%Y-%m-%d %H:%M:%OS", new DateTime(2009,7,1,0,0,0));
  }


  private void verifyFormat(String x, String format, DateTime dateTime) {
    DateTimeFormatter formatter = DateTimeFormat.forPattern(format);
    assertThat(formatter.print(dateTime), equalTo(x));
    assertThat(formatter.parseDateTime(x), equalTo(dateTime));
  }
View Full Code Here

Examples of org.joda.time.format.DateTimeFormatter

        if("isis:String".equals(dataType)) {
            return (T)getChildTextValue(chldEl);
        }
        if("isis:LocalDate".equals(dataType)) {
            final String str = getChildTextValue(chldEl);
            final DateTimeFormatter forPattern = DateTimeFormat.forPattern("dd-MMM-yyyy").withLocale(Locale.ENGLISH);
            return (T)forPattern.parseLocalDate(str);
        }
        if("isis:Byte".equals(dataType)) {
            final String str = getChildTextValue(chldEl);
            return (T)new Byte(str);
        }
View Full Code Here

Examples of org.joda.time.format.DateTimeFormatter

    public String titleString(final Object value, final Localization localization) {
        if (value == null) {
            return null;
        }
        final LocalDate date = (LocalDate) value;
        DateTimeFormatter f = titleStringFormatter;
        if (localization != null) {
            f = titleStringFormatter.withLocale(localization.getLocale());
        }
        return JodaLocalDateUtil.titleString(f, date);
    }
View Full Code Here

Examples of org.joda.time.format.DateTimeFormatter

    public String titleString(final Object value, final Localization localization) {
        if (value == null) {
            return null;
        }
        final LocalDateTime dateTime = (LocalDateTime) value;
        DateTimeFormatter f = titleStringFormatter;
        if (localization != null) {
            f = titleStringFormatter.withLocale(localization.getLocale());
        }
        return JodaLocalDateTimeUtil.titleString(f, dateTime);
    }
View Full Code Here

Examples of org.joda.time.format.DateTimeFormatter

        }

        if(_props.containsKey("output.path")) {
            String location = _props.get("output.path");
            if(location.endsWith("#CURRENT")) {
                DateTimeFormatter format = DateTimeFormat.forPattern(COMMON_FILE_DATE_PATTERN);
                String destPath = format.print(new DateTime());
                location = location.substring(0, location.length() - "#CURRENT".length())
                           + destPath;
                System.out.println("Store location set to " + location);
            }
View Full Code Here

Examples of org.joda.time.format.DateTimeFormatter

    public String formatDateTime(DateTime date) {
        return formatDate(date, "MM-dd-yyyy HH:mm:ss");
    }

    public String formatDate(DateTime date, String format) {
        DateTimeFormatter f = DateTimeFormat.forPattern(format);
        return f.print(date);
    }
View Full Code Here

Examples of org.joda.time.format.DateTimeFormatter

    } else {
      try {
        MapMessage report = ActiveMQDirector.getSession().createMapMessage();

        DateTime now = new DateTime();
        DateTimeFormatter iso8601formatter = ISODateTimeFormat.dateTime();
        report.setString("timestamp", iso8601formatter.print(now));
        report.setString("queue", queueName);
        report.setString("id", id);
        report.setString("level", level.toLowerCase());
        if (message != null)
          report.setString("message", message);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.