List of usage examples for org.joda.time DateTimeZone forTimeZone
public static DateTimeZone forTimeZone(TimeZone zone)
From source file:com.facebook.presto.jdbc.ext.PrestoResultSet.java
License:Apache License
@Override public Time getTime(int columnIndex, Calendar cal) throws SQLException { return getTime(columnIndex, DateTimeZone.forTimeZone(cal.getTimeZone())); }
From source file:com.facebook.presto.jdbc.ext.PrestoResultSet.java
License:Apache License
@Override public Timestamp getTimestamp(int columnIndex, Calendar cal) throws SQLException { return getTimestamp(columnIndex, DateTimeZone.forTimeZone(cal.getTimeZone())); }
From source file:com.facebook.presto.raptor.storage.StorageManagerConfig.java
License:Apache License
public DateTimeZone getShardDayBoundaryTimeZone() { return DateTimeZone.forTimeZone(TimeZone.getTimeZone(shardDayBoundaryTimeZone)); }
From source file:com.github.markserrano.jsonquery.jpa.util.DateTimeUtil.java
License:Apache License
public static DateTime getDateTimeWithOffset(DateTime dt) { DateTime dateTime = dt.withZone(DateTimeZone.forTimeZone(TIMEZONE)); return normalize(dateTime); }
From source file:com.google.sampling.experiential.server.BackendReportJobExecutorServlet.java
License:Open Source License
public static DateTimeZone getTimeZoneForClient(HttpServletRequest req) { String tzStr = getParam(req, "tz"); if (tzStr != null && !tzStr.isEmpty()) { try {/*from ww w . j a v a2s . c o m*/ DateTimeZone jodaTimeZone = DateTimeZone.forID(tzStr); return jodaTimeZone; } catch (Exception e) { log.warning("Could not get DateTimeZone for string: " + tzStr); } } Locale clientLocale = req.getLocale(); Calendar calendar = Calendar.getInstance(clientLocale); TimeZone clientTimeZone = calendar.getTimeZone(); DateTimeZone jodaTimeZone = DateTimeZone.forTimeZone(clientTimeZone); return jodaTimeZone; }
From source file:com.google.sampling.experiential.server.JobStatusServlet.java
License:Open Source License
public static DateTimeZone getTimeZoneForClient(HttpServletRequest req) { String tzStr = getParam(req, "tz"); if (tzStr != null && !tzStr.isEmpty()) { DateTimeZone jodaTimeZone = DateTimeZone.forID(tzStr); return jodaTimeZone; } else {//from w ww. j a v a2 s. c o m Locale clientLocale = req.getLocale(); Calendar calendar = Calendar.getInstance(clientLocale); TimeZone clientTimeZone = calendar.getTimeZone(); DateTimeZone jodaTimeZone = DateTimeZone.forTimeZone(clientTimeZone); return jodaTimeZone; } }
From source file:com.graphaware.module.timetree.domain.TimeInstant.java
License:Open Source License
/** * Create an instant from its corresponding value object. * * @param vo to create the instant from. * @return instant./*from w ww .ja v a2 s. co m*/ */ public static TimeInstant fromValueObject(TimeInstantVO vo) { TimeInstant instant = TimeInstant.instant(vo.getTime()); if (vo.getResolution() != null) { instant = instant.with(Resolution.valueOf(vo.getResolution().toUpperCase())); } if (vo.getTimezone() != null) { instant = instant.with(DateTimeZone.forTimeZone(TimeZone.getTimeZone(vo.getTimezone()))); } return instant; }
From source file:com.graphaware.module.timetree.module.TimeTreeModuleBootstrapper.java
License:Open Source License
/** * {@inheritDoc}//from w w w .ja v a 2s. com */ @Override public RuntimeModule bootstrapModule(String moduleId, Map<String, String> config, GraphDatabaseService database) { TimeTreeConfiguration configuration = TimeTreeConfiguration.defaultConfiguration(); if (config.get(EVENT) != null) { NodeInclusionPolicy policy = StringToNodeInclusionPolicy.getInstance().apply(config.get(EVENT)); LOG.info("Node Inclusion Strategy set to {}", policy); configuration = configuration.with(policy); } if (config.get(TIMESTAMP_PROPERTY) != null) { String timestampProperty = config.get(TIMESTAMP_PROPERTY); LOG.info("Timestamp Property set to {}", timestampProperty); configuration = configuration.withTimestampProperty(timestampProperty); } if (config.get(CUSTOM_TIMETREE_ROOT_PROPERTY) != null) { String customTimeTreeRootProperty = config.get(CUSTOM_TIMETREE_ROOT_PROPERTY); LOG.info("Custom TimeTree Root Property set to {}", customTimeTreeRootProperty); configuration = configuration.withCustomTimeTreeRootProperty(customTimeTreeRootProperty); } if (config.get(RESOLUTION) != null) { Resolution resolution = Resolution.valueOf(config.get(RESOLUTION).toUpperCase()); LOG.info("Resolution set to {}", resolution); configuration = configuration.withResolution(resolution); } if (config.get(TIME_ZONE) != null) { DateTimeZone timeZone = DateTimeZone.forTimeZone(TimeZone.getTimeZone(config.get(TIME_ZONE))); LOG.info("Time zone set to {}", timeZone); configuration = configuration.withTimeZone(timeZone); } if (config.get(RELATIONSHIP) != null) { RelationshipType relationshipType = DynamicRelationshipType.withName(config.get(RELATIONSHIP)); LOG.info("Relationship type set to {}", relationshipType); configuration = configuration.withRelationshipType(relationshipType); } if (config.get(AUTO_ATTACH) != null) { boolean autoAttach = Boolean.valueOf(config.get(AUTO_ATTACH)); LOG.info("AutoAttach set to {}", autoAttach); configuration = configuration.withAutoAttach(autoAttach); } return new TimeTreeModule(moduleId, configuration, database); }
From source file:com.gs.fw.common.mithra.attribute.calculator.arithmeticCalculator.TimestampYearCalculator.java
License:Apache License
@Override public Operation optimizedIntegerEq(int value, CalculatedIntegerAttribute intAttribute) { DateTimeZone dateTimeZone = DateTimeZone.forTimeZone(MithraTimestamp.DefaultTimeZone); DateTime dateBefore = new DateTime().withZone(dateTimeZone).withYear(value).withDayOfMonth(1) .withMonthOfYear(1).withTimeAtStartOfDay(); DateTime dateAfter = new DateTime().withZone(dateTimeZone).withYear(value + 1).withDayOfMonth(1) .withMonthOfYear(1).withTimeAtStartOfDay(); Timestamp timestampBefore = new Timestamp(dateBefore.getMillis()); Timestamp timestampAfter = new Timestamp(dateAfter.getMillis()); return this.attribute.greaterThanEquals(timestampBefore).and(attribute.lessThan(timestampAfter)); }
From source file:com.gs.fw.common.mithra.util.MithraTimestamp.java
License:Apache License
protected static int getOffsetFromTimeZoneToUtc(TimeZone tz, Date date) { if (date.getTime() <= TIME_FOR_1950_01_01) { return DateTimeZone.forTimeZone(tz).getOffset(date.getTime()); } else {/* w ww. ja va2 s .co m*/ int offset = tz.getRawOffset(); if (tz.inDaylightTime(date)) { offset += tz.getDSTSavings(); } return offset; } }