Package org.joda.time

Examples of org.joda.time.DateTimeZone


        this.username = user.getName();
        this.fullname = user.getFullName();
        this.email = user.getEmail();
        this.password = "";
        this.permissions  = user.getPermissions();
        final DateTimeZone timeZone = user.getTimeZone();
        if (timezone != null) {
            this.timezone = timeZone.getID();
        }
        this.sessionTimeoutMs = user.getSessionTimeoutMs();
    }
View Full Code Here


     */
    @DwrPermission(user = true)
    public String getImageChartData(int[] pointIds, int fromYear, int fromMonth, int fromDay, int fromHour,
            int fromMinute, int fromSecond, boolean fromNone, int toYear, int toMonth, int toDay, int toHour,
            int toMinute, int toSecond, boolean toNone, int width, int height) {
        DateTimeZone dtz = Common.getUser().getDateTimeZoneInstance();
        DateTime from = createDateTime(fromYear, fromMonth, fromDay, fromHour, fromMinute, fromSecond, fromNone, dtz);
        DateTime to = createDateTime(toYear, toMonth, toDay, toHour, toMinute, toSecond, toNone, dtz);

        StringBuilder htmlData = new StringBuilder();
        htmlData.append("<img src=\"achart/ft_");
View Full Code Here

    @DwrPermission(user = true)
    public void getChartData(int[] pointIds, int fromYear, int fromMonth, int fromDay, int fromHour, int fromMinute,
            int fromSecond, boolean fromNone, int toYear, int toMonth, int toDay, int toHour, int toMinute,
            int toSecond, boolean toNone) {
        User user = Common.getUser();
        DateTimeZone dtz = user.getDateTimeZoneInstance();
        DateTime from = createDateTime(fromYear, fromMonth, fromDay, fromHour, fromMinute, fromSecond, fromNone, dtz);
        DateTime to = createDateTime(toYear, toMonth, toDay, toHour, toMinute, toSecond, toNone, dtz);
        DataExportDefinition def = new DataExportDefinition(pointIds, from, to);
        user.setDataExportDefinition(def);
    }
View Full Code Here

    public static Date getTimeAsDate() {
        return new Date(getTime());
    }

    public static LocalDate getTimeAsLocalDate() {
        final DateTimeZone timeZone = DateTimeZone.forTimeZone(TimeZone.getDefault());
        return new LocalDate(getTime(), timeZone);
    }
View Full Code Here

    public DateTime(final long millisSinceEpoch) {
        this.dateTime = new org.joda.time.DateTime(millisSinceEpoch, Defaults.getTimeZone());
    }

    public DateTime(final Date date, final TimeZone timeZone) {
        final DateTimeZone tz = DateTimeZone.forTimeZone(timeZone);
        this.dateTime = new org.joda.time.DateTime(date, tz);
    }
View Full Code Here

    @Override
    public Time getTime(final String columnName) {
        try {
            final String string = set.getString(columnName);
            final DateTimeFormatter formatter = DateTimeFormat.forPattern("HH:mm:ss");
            final DateTimeZone defaultTimeZone = Defaults.getTimeZone();
            final DateTime utcDate = formatter.withZone(defaultTimeZone).parseDateTime(string);
            return new Time(utcDate);
        } catch (final SQLException e) {
            throw new SqlObjectStoreException(e);
        }
View Full Code Here

    public DateTime(final long millisSinceEpoch) {
        this.dateTime = new org.joda.time.DateTime(millisSinceEpoch, Defaults.getTimeZone());
    }

    public DateTime(final Date date, final TimeZone timeZone) {
        final DateTimeZone tz = DateTimeZone.forTimeZone(timeZone);
        this.dateTime = new org.joda.time.DateTime(date, tz);
    }
View Full Code Here

    /**
     * {@inheritDoc}
     */
    public org.jboss.dna.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);
    }
View Full Code Here

      entry.setUpdateDate(new Date());
    }
    if (entry.getPublishDate() == null) {
      entry.setPublishDate(new Date());
    }
    DateTimeZone zoneUTC = DateTimeZone.UTC;
    DateTime dateTime = new DateTime(entry.getPublishDate());
    entry.setPublishDateGMT(dateTime.withZone(zoneUTC).toDate());
    dateTime = new DateTime(entry.getUpdateDate());
    entry.setUpdateDateGMT(dateTime.withZone(zoneUTC).toDate());
    dateTime = new DateTime(entry.getCreateDate());
View Full Code Here

            return getTimeZone(runtime, tz.toString());
        }
    }
    
    public static DateTimeZone getTimeZone(Ruby runtime, String zone) {
        DateTimeZone cachedZone = runtime.getTimezoneCache().get(zone);

        if (cachedZone != null) return cachedZone;

        String originalZone = zone;
        TimeZone tz = TimeZone.getTimeZone(getEnvTimeZone(runtime).toString());

        // Value of "TZ" property is of a bit different format,
        // which confuses the Java's TimeZone.getTimeZone(id) method,
        // and so, we need to convert it.

        Matcher tzMatcher = TZ_PATTERN.matcher(zone);
        if (tzMatcher.matches()) {                   
            String sign = tzMatcher.group(2);
            String hours = tzMatcher.group(3);
            String minutes = tzMatcher.group(4);
               
            // GMT+00:00 --> Etc/GMT, see "MRI behavior"
            // comment below.
            if (("00".equals(hours) || "0".equals(hours)) &&
                    (minutes == null || ":00".equals(minutes) || ":0".equals(minutes))) {
                zone = "Etc/GMT";
            } else {
                // Invert the sign, since TZ format and Java format
                // use opposite signs, sigh... Also, Java API requires
                // the sign to be always present, be it "+" or "-".
                sign = ("-".equals(sign)? "+" : "-");

                // Always use "GMT" since that's required by Java API.
                zone = "GMT" + sign + hours;

                if (minutes != null) {
                    zone += minutes;
                }
            }
           
            tz = TimeZone.getTimeZone(zone);
        } else {
            if (LONG_TZNAME.containsKey(zone)) tz.setID(LONG_TZNAME.get(zone.toUpperCase()));
        }

        // MRI behavior: With TZ equal to "GMT" or "UTC", Time.now
        // is *NOT* considered as a proper GMT/UTC time:
        //   ENV['TZ']="GMT"
        //   Time.now.gmt? ==> false
        //   ENV['TZ']="UTC"
        //   Time.now.utc? ==> false
        // Hence, we need to adjust for that.
        if ("GMT".equalsIgnoreCase(zone) || "UTC".equalsIgnoreCase(zone)) {
            zone = "Etc/" + zone;
            tz = TimeZone.getTimeZone(zone);
        }

        DateTimeZone dtz = DateTimeZone.forTimeZone(tz);
        runtime.getTimezoneCache().put(originalZone, dtz);
        return dtz;
    }
View Full Code Here

TOP

Related Classes of org.joda.time.DateTimeZone

Copyright © 2018 www.massapicom. 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.