Example usage for org.joda.time DateTimeZone forID

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

Introduction

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

Prototype

@FromString
public static DateTimeZone forID(String id) 

Source Link

Document

Gets a time zone instance for the specified time zone id.

Usage

From source file:org.modeshape.graph.property.basic.JodaDateTime.java

License:Open Source License

public JodaDateTime(String iso8601, String timeZoneId) {
    this.instance = new DateTime(iso8601, DateTimeZone.forID(timeZoneId));
    this.millisInUtc = instance.withZone(UTC_ZONE).getMillis();
}

From source file:org.modeshape.graph.property.basic.JodaDateTime.java

License:Open Source License

public JodaDateTime(long milliseconds, String timeZoneId) {
    this.instance = new DateTime(milliseconds, DateTimeZone.forID(timeZoneId));
    this.millisInUtc = instance.withZone(UTC_ZONE).getMillis();
}

From source file:org.modeshape.graph.property.basic.JodaDateTime.java

License:Open Source License

public JodaDateTime(int year, int monthOfYear, int dayOfMonth, int hourOfDay, int minuteOfHour,
        int secondOfMinute, int millisecondsOfSecond, String timeZoneId) {
    this.instance = new DateTime(year, monthOfYear, dayOfMonth, hourOfDay, minuteOfHour, secondOfMinute,
            millisecondsOfSecond, DateTimeZone.forID(timeZoneId));
    this.millisInUtc = instance.withZone(UTC_ZONE).getMillis();
}

From source file:org.modeshape.graph.property.basic.JodaDateTime.java

License:Open Source License

/**
 * {@inheritDoc}//from  w ww. ja v a2 s .c  om
 */
public org.modeshape.graph.property.DateTime toUtcTimeZone() {
    DateTimeZone utc = DateTimeZone.forID("UTC");
    if (this.instance.getZone().equals(utc))
        return this;
    DateTime jodaTime = this.instance.withZone(utc);
    return new JodaDateTime(jodaTime);
}

From source file:org.modeshape.graph.property.basic.JodaDateTime.java

License:Open Source License

/**
 * {@inheritDoc}/* w w w.  j  a v  a  2s.  com*/
 */
public org.modeshape.graph.property.DateTime toTimeZone(String timeZoneId) {
    CheckArg.isNotNull(timeZoneId, "time zone identifier");
    DateTime jodaTime = this.instance.withZone(DateTimeZone.forID(timeZoneId));
    return new JodaDateTime(jodaTime);
}

From source file:org.modeshape.jcr.value.basic.JodaDateTime.java

License:Apache License

@Override
public org.modeshape.jcr.api.value.DateTime toUtcTimeZone() {
    DateTimeZone utc = DateTimeZone.forID("UTC");
    if (this.instance.getZone().equals(utc))
        return this;
    DateTime jodaTime = this.instance.withZone(utc);
    return new JodaDateTime(jodaTime);
}

From source file:org.modeshape.jcr.value.basic.JodaDateTime.java

License:Apache License

@Override
public org.modeshape.jcr.api.value.DateTime toTimeZone(String timeZoneId) {
    CheckArg.isNotNull(timeZoneId, "time zone identifier");
    DateTime jodaTime = this.instance.withZone(DateTimeZone.forID(timeZoneId));
    return new JodaDateTime(jodaTime);
}

From source file:org.myorganisation.myproject.quickstart.backend.restful.war.DateTimeUtilities.java

License:Apache License

/**
 * Assigns the timezone of the DateTimeUtilities singleton instance, creating it if necessary.
 *
 * @param timezone The ID of the DateTimeZone to set.
 * @return The singleton DateTimeUtilities instance.
 */// w w w .  jav a  2 s.c  o  m
public static DateTimeUtilities setTimeZone(final String timezone) {

    final DateTimeZone dateTimeZone = DateTimeZone.forID(timezone);
    if (instance == null) {
        instance = new DateTimeUtilities(dateTimeZone);
    } else {
        instance.dateTimeZone = dateTimeZone;
    }

    // All done.
    return instance;
}

From source file:org.n52.io.type.quantity.handler.img.ChartIoHandler.java

License:Open Source License

private DateTimeZone getTimezone() {
    IoParameters parameters = getParameters();
    return DateTimeZone.forID(parameters.getOutputTimezone());
}

From source file:org.obm.push.calendar.ObmEventToMSEventConverterImpl.java

License:Open Source License

private DateTime buildOccurrenceDateTime(Event event, Date excp) {
    DateTimeZone eventTimeZone = DateTimeZone.forID(event.getTimezoneName());
    DateTime tzEventDataTime = new DateTime(event.getStartDate(), eventTimeZone);

    return new DateTime(excp, DateTimeZone.UTC).withZone(eventTimeZone)
            .withMillisOfDay(tzEventDataTime.getMillisOfDay()).withZone(DateTimeZone.UTC);
}