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.mycollab.vaadin.web.ui.field.DateTimeOptionField.java

License:Open Source License

@Override
public void setPropertyDataSource(Property newDataSource) {
    Date value = (Date) newDataSource.getValue();
    if (value != null) {
        DateTime jodaTime = new DateTime(value);
        jodaTime = jodaTime.toDateTime(DateTimeZone.forTimeZone(UserUIContext.getUserTimeZone()));
        int hrs = jodaTime.getHourOfDay();
        int min = jodaTime.getMinuteOfHour();
        String timeFormat = "AM";
        if (hrs > 12) {
            hrs -= 12;//www .j  a  va 2  s. com
            timeFormat = "PM";
        }

        if ((hrs > 0 || min > 0) && hideTimeOption) {
            toggleHideTimeOption(false);
        }

        popupDateField.setPropertyDataSource(new ObjectProperty(jodaTime.toDate()));
        if (!hideTimeOption) {
            hourPickerComboBox.setPropertyDataSource(new ObjectProperty((hrs < 10) ? "0" + hrs : "" + hrs));
            minutePickerComboBox.setPropertyDataSource(new ObjectProperty((min < 10) ? "0" + min : "" + min));
            timeFormatComboBox.setPropertyDataSource(new ObjectProperty(timeFormat));
        }
    }
    super.setPropertyDataSource(newDataSource);
}

From source file:com.mycollab.vaadin.web.ui.field.DateTimeOptionField.java

License:Open Source License

private Date getDateValue() {
    Date selectDate = popupDateField.getValue();
    if (selectDate == null) {
        return null;
    }//from   w w  w .j  a  v  a  2 s .c om

    DateTime jodaSelectDate = new DateTime(selectDate)
            .toDateTime(DateTimeZone.forTimeZone(UserUIContext.getUserTimeZone()));
    Date baseDate = new LocalDate(jodaSelectDate).toDate();
    if (hideTimeOption) {
        return new LocalDateTime(baseDate).toDateTime(DateTimeZone.forTimeZone(UserUIContext.getUserTimeZone()))
                .toDate();
    } else {
        Integer hour = (hourPickerComboBox.getValue() != null)
                ? Integer.parseInt((String) hourPickerComboBox.getValue())
                : 0;
        Integer minus = (minutePickerComboBox.getValue() != null)
                ? Integer.parseInt((String) minutePickerComboBox.getValue())
                : 0;
        String timeFormat = (timeFormatComboBox.getValue() != null) ? (String) timeFormatComboBox.getValue()
                : "AM";
        long milliseconds = calculateMilliSeconds(hour, minus, timeFormat);
        DateTime jodaTime = new DateTime(baseDate).plus(new Duration(milliseconds));
        return new LocalDateTime(jodaTime.getMillis())
                .toDateTime(DateTimeZone.forTimeZone(UserUIContext.getUserTimeZone())).toDate();
    }
}

From source file:com.pandits.opensource.JodaTimeUtil.java

License:Open Source License

private DateTimeZone findTimeZone(TimeZone timeZone) {
    return DateTimeZone.forTimeZone(timeZone);
}

From source file:com.payintech.smoney.entity.BankTransferEntity.java

License:Open Source License

/**
 * Get the payment date on a specific timezone.
 *
 * @param timeZone The timezone to use//from w ww  .j  a  v  a2 s .c  o m
 * @return The datetime converted to the specific timezone
 * @since 16.02
 */
public DateTime getPaymentDate(final TimeZone timeZone) {
    return this.PaymentDate.toDateTime(DateTimeZone.forTimeZone(timeZone));
}

From source file:com.payintech.smoney.entity.CardEntity.java

License:Open Source License

/**
 * Get the card expiry date on a specific timezone.
 *
 * @param timeZone The timezone to use/*from   www . j  av a2  s  . com*/
 * @return The datetime converted to the specific timezone
 * @since 16.02
 */
public DateTime getExpiryDate(final TimeZone timeZone) {
    if (this.ExpiryDate == null) {
        return null;
    }
    return this.ExpiryDate.toDateTime(DateTimeZone.forTimeZone(timeZone));
}

From source file:com.payintech.smoney.entity.HistoryItemEntity.java

License:Open Source License

/**
 * Get the operation date on a specific timezone.
 *
 * @param timeZone The timezone to use/*from w w w.  j a  v  a2s.co  m*/
 * @return The datetime converted to the specific timezone
 * @since 16.02
 */
public DateTime getOperationDate(final TimeZone timeZone) {
    return this.OperationDate.toDateTime(DateTimeZone.forTimeZone(timeZone));
}

From source file:com.payintech.smoney.entity.KycEntity.java

License:Open Source License

/**
 * Get the request date on a specific timezone.
 *
 * @param timeZone The timezone to use/*ww w. j a va 2  s.c  om*/
 * @return The datetime converted to the specific timezone
 * @since 16.02
 */
public DateTime getRequestDate(final TimeZone timeZone) {
    return this.RequestDate.toDateTime(DateTimeZone.forTimeZone(timeZone));
}

From source file:com.payintech.smoney.entity.PaymentScheduleEntity.java

License:Open Source License

/**
 * Get the date on a specific timezone.//www . ja v  a2 s.  co m
 *
 * @param timeZone The timezone to use
 * @return The datetime converted to the specific timezone
 * @since 16.02
 */
public DateTime getDate(final TimeZone timeZone) {
    return this.Date.toDateTime(DateTimeZone.forTimeZone(timeZone));
}

From source file:com.payintech.smoney.entity.ProfileEntity.java

License:Open Source License

/**
 * Get the birthdate date on a specific timezone.
 *
 * @param timeZone The timezone to use// www .  j a va2s  .c o m
 * @return The datetime converted to the specific timezone
 * @since 16.02
 */
public DateTime getBirthdate(final TimeZone timeZone) {
    if (this.Birthdate != null) {
        return this.Birthdate.toDateTime(DateTimeZone.forTimeZone(timeZone));
    }
    return null;
}

From source file:com.payintech.smoney.entity.SubAccountEntity.java

License:Open Source License

/**
 * Get the creation date on a specific timezone.
 *
 * @param timeZone The timezone to use//w  w w  . jav  a  2s  . co m
 * @return The datetime converted to the specific timezone
 * @since 16.02
 */
public DateTime getCreationDate(final TimeZone timeZone) {
    return this.CreationDate.toDateTime(DateTimeZone.forTimeZone(timeZone));
}