Package org.joda.time.format

Examples of org.joda.time.format.DateTimeFormatter.withZone()


    {
      TimeZone zone = getClientTimeZone();
      DateTime dateTime;

      // set time zone for client
      format = format.withZone(getTimeZone());

      try
      {
        // parse date retaining the time of the submission
        dateTime = format.parseDateTime(value);
View Full Code Here


    {
      TimeZone zone = getClientTimeZone();
      DateTime dateTime = null;

      // set time zone for client
      format = format.withZone(getTimeZone());

      try
      {
        // parse date retaining the time of the submission
        dateTime = format.parseDateTime(value);
View Full Code Here

    {
      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

      // instantiate now/ current time
      MutableDateTime dt = new MutableDateTime(new DateMidnight());
      if (zone != null)
      {
        // set time zone for client
        format = format.withZone(DateTimeZone.forTimeZone(zone));
        dt.setZone(DateTimeZone.forTimeZone(zone));
      }
      try
      {
        // parse date retaining the time of the submission
View Full Code Here

    {
      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

    //按不同的时区分析字符串,得到不同的时间
    String dateString = "1978-06-01 12:10:08";
    DateTimeFormatter fmt = DateTimeFormat.forPattern("yyyy-MM-dd HH:mm:ss");

    DateTime parserResult1 = fmt.withZone(DateTimeZone.forID("US/Pacific")).parseDateTime(dateString);
    DateTime parserResult2 = fmt.withZone(DateTimeZone.UTC).parseDateTime(dateString);

    System.out.println(parserResult1.toString(format) + " " + parserResult1.getMillis());
    System.out.println(parserResult2.toString(format) + " " + parserResult2.getMillis());
  }
View Full Code Here

    //按不同的时区分析字符串,得到不同的时间
    String dateString = "1978-06-01 12:10:08";
    DateTimeFormatter fmt = DateTimeFormat.forPattern("yyyy-MM-dd HH:mm:ss");

    DateTime parserResult1 = fmt.withZone(DateTimeZone.forID("US/Pacific")).parseDateTime(dateString);
    DateTime parserResult2 = fmt.withZone(DateTimeZone.UTC).parseDateTime(dateString);

    System.out.println(parserResult1.toString(format) + " " + parserResult1.getMillis());
    System.out.println(parserResult2.toString(format) + " " + parserResult2.getMillis());
  }
View Full Code Here

            }
        }
        if (!_explicitTimezone) {
            TimeZone tz = provider.getTimeZone();
            if (tz != null && !tz.equals(_jdkTimezone)) {
                formatter = formatter.withZone(DateTimeZone.forTimeZone(tz));
            }
        }
       
        return formatter;
    }
View Full Code Here

            formatter = DateTimeFormat.forPattern(format);
        }
        if (_locale != null) {
            formatter = formatter.withLocale(_locale);
        }
        formatter = formatter.withZone(_formatter.getZone());
        return new JacksonJodaFormat(this, formatter);
    }
   
    protected JacksonJodaFormat withTimeZone(TimeZone tz) {
        if ((tz == null) || (_jdkTimezone != null && _jdkTimezone.equals(tz))) {
View Full Code Here

  }

  Object parse(final String data) {
    try {
      final DateTimeFormatter parseFormat = DateTimeFormat.forPattern(ISO_FORMAT);
      final DateTime date = parseFormat.withZone(DateTimeZone.UTC).parseDateTime(data);
      final DateMidnight dateMidnight = date.toDateMidnight();
      return dateMidnight;
    } catch (final Exception ex) {
      log.error("Can't parse DateMidnight: " + data);
      return new DateMidnight();
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.