Example usage for org.joda.time DateTimeZone forTimeZone

List of usage examples for org.joda.time DateTimeZone forTimeZone

Introduction

In this page you can find the example usage for org.joda.time DateTimeZone forTimeZone.

Prototype

public static DateTimeZone forTimeZone(TimeZone zone) 

Source Link

Document

Gets a time zone instance for a JDK TimeZone.

Usage

From source file:com.gs.fw.common.mithra.util.MithraTimestamp.java

License:Apache License

public static void zSetDefaultTimezone(TimeZone timezone) {
    DEFAULT_TIMEZONE = DateTimeZone.forTimeZone(timezone);
}

From source file:com.helger.datetime.PDTFactory.java

License:Apache License

@Nonnull
public static DateTime createDateTime(@Nonnull final Date aDate, @Nonnull final TimeZone aTimeZone) {
    return createDateTime(aDate, DateTimeZone.forTimeZone(aTimeZone));
}

From source file:com.helger.datetime.PDTFactory.java

License:Apache License

@Nonnull
public static DateTime createDateTime(@Nonnull final Calendar aCalendar) {
    return new DateTime(aCalendar,
            PDTConfig.getDefaultChronology().withZone(DateTimeZone.forTimeZone(aCalendar.getTimeZone())));
}

From source file:com.helger.datetime.PDTFactory.java

License:Apache License

/**
 * Creates a LocalDate. Does not use the Chronology of the Calendar.
 *
 * @param aCalendar/*from  w  ww . ja  v  a 2s .co  m*/
 *        The calendar to be converted.
 * @return The local date representing the provided date.
 */
@Nonnull
public static LocalDate createLocalDate(@Nonnull final Calendar aCalendar) {
    return new LocalDate(aCalendar,
            getLocalChronology().withZone(DateTimeZone.forTimeZone(aCalendar.getTimeZone())));
}

From source file:com.helger.datetime.PDTFactory.java

License:Apache License

@Nonnull
public static LocalDate createLocalDate(@Nonnull final Date aDate, final TimeZone aTimeZone) {
    return createLocalDate(aDate, DateTimeZone.forTimeZone(aTimeZone));
}

From source file:com.helger.datetime.PDTFactory.java

License:Apache License

@Nonnull
public static LocalTime createLocalTime(@Nonnull final Date aDate, @Nonnull final TimeZone aTimeZone) {
    return new LocalTime(aDate, DateTimeZone.forTimeZone(aTimeZone));
}

From source file:com.helger.datetime.PDTFactory.java

License:Apache License

@Nonnull
public static LocalTime createLocalTime(@Nonnull final Calendar aCalendar) {
    return new LocalTime(aCalendar,
            getLocalChronology().withZone(DateTimeZone.forTimeZone(aCalendar.getTimeZone())));
}

From source file:com.helger.datetime.PDTFactory.java

License:Apache License

@Nonnull
public static LocalDateTime createLocalDateTime(@Nonnull final Date aDate, @Nonnull final TimeZone aTimeZone) {
    return createLocalDateTime(aDate, DateTimeZone.forTimeZone(aTimeZone));
}

From source file:com.helger.datetime.PDTFactory.java

License:Apache License

@Nonnull
public static LocalDateTime createLocalDateTime(@Nonnull final Calendar aCalendar) {
    return new LocalDateTime(aCalendar,
            getLocalChronology().withZone(DateTimeZone.forTimeZone(aCalendar.getTimeZone())));
}

From source file:com.jbirdvegas.mgerrit.helpers.Tools.java

License:Apache License

public static DateTime parseDate(String dateStr, TimeZone serverTimeZone, TimeZone localTimeZone) {
    try {//from ww w  .ja v a 2s.co m
        DateTime d = DATE_TIME_FORMATTER.withZone(DateTimeZone.forTimeZone(serverTimeZone))
                .parseDateTime(dateStr);
        return d.withZone(DateTimeZone.forTimeZone(localTimeZone)).withMillisOfDay(0);
    } catch (IllegalArgumentException e) {
        return new DateTime(0);
    }
}