List of usage examples for java.util TimeZone getTimeZone
public static TimeZone getTimeZone(ZoneId zoneId)
From source file:guru.nidi.loader.url.SimpleUrlFetcher.java
private String httpDate(long date) { final SimpleDateFormat format = new SimpleDateFormat(HTTP_DATE_FORMAT, Locale.ENGLISH); format.setTimeZone(TimeZone.getTimeZone("GMT")); return format.format(date); }
From source file:com.persistent.cloudninja.scheduler.PerformanceMonitor.java
@Override public boolean execute() { StopWatch watch = new StopWatch(); try {/*from w w w . j ava 2 s. c om*/ LOGGER.debug("PerformanceMonitor : Execute"); watch.start(); Date lastReadTime = kpiValueTempDao.getMaxTimestamp(); Date lastBatchTime = null; Calendar calendar = Calendar.getInstance(); SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.S z"); dateFormat.setTimeZone(TimeZone.getTimeZone("UTC")); String date = null; if (lastReadTime == null) { date = dateFormat.format(calendar.getTime()); lastReadTime = dateFormat.parse(date); } calendar = Calendar.getInstance(); date = dateFormat.format(calendar.getTime()); Date currentUTCTime = dateFormat.parse(date); List<KpiValueTempEntity> listKpiValueTempEntities = null; while (lastReadTime.getTime() <= currentUTCTime.getTime()) { LOGGER.debug("PerformanceMonitor : Process performance counters"); calendar.setTime(lastReadTime); calendar.add(Calendar.MINUTE, 30); date = dateFormat.format(calendar.getTime()); lastBatchTime = dateFormat.parse(date); WADPerformanceCountersEntity[] arrPerfCounter = storageUtility .getPerfCounterEntities(lastReadTime.getTime(), lastBatchTime.getTime()); listKpiValueTempEntities = convertAzureEntityToDBEntity(arrPerfCounter); kpiValueTempDao.addAll(listKpiValueTempEntities); kpiValueTempDao.executeProcessKpiValues(); LOGGER.debug("PerformanceMonitor : Process complete"); lastReadTime = lastBatchTime; } watch.stop(); taskCompletionDao.updateTaskCompletionDetails(watch.getTotalTimeSeconds(), "ProcessPerformanceCounters", ""); LOGGER.debug("PerformanceMonitor : Finish"); } catch (ParseException e) { LOGGER.error(e.getMessage(), e); } return true; }
From source file:net.naonedbus.rest.controller.impl.HoraireController.java
public HoraireController() { super("horaires"); mDateDecode.setTimeZone(TimeZone.getTimeZone("GMT")); }
From source file:com.gigya.flume.TestElasticSearchIndexRequestBuilderFactory.java
void initDefaults() { timestampedIndexName = DEFAULT_INDEX_NAME + '-' + ElasticSearchIndexRequestBuilderFactory.df.format(FIXED_TIME_MILLIS); dateFormat = FastDateFormat.getInstance("yyyy.MM.dd", TimeZone.getTimeZone("Etc/UTC")); }
From source file:com.zimbra.examples.extns.samlprovider.SamlAuthToken.java
/** * Constructs instance from a SAML assertion element. * * @param samlAssertionElt/*from w w w . j a va 2 s . c o m*/ * @throws AuthTokenException */ public SamlAuthToken(Element samlAssertionElt) throws AuthTokenException { Element authnStmtElt; try { id = samlAssertionElt.getAttribute("ID"); Element subjectElt = samlAssertionElt.getElement("Subject"); Element nameIdElt = subjectElt.getElement("NameID"); subjectNameId = nameIdElt.getTextTrim(); Element conditionsElt = samlAssertionElt.getElement("Conditions"); String notOnOrAfter = conditionsElt.getAttribute("NotOnOrAfter"); SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss'Z'"); dateFormat.setTimeZone(TimeZone.getTimeZone("UTC")); expires = dateFormat.parse(notOnOrAfter); authnStmtElt = samlAssertionElt.getElement("AuthnStatement"); } catch (Exception e) { ZimbraLog.extensions.error(e); throw new AuthTokenException("Error in parsing SAML auth token", e); } if (authnStmtElt == null) throw new AuthTokenException("SAML auth token does not contain any authentication statement"); }
From source file:io.wcm.devops.conga.plugins.aem.util.JsonContentLoaderTest.java
@Test public void testCalendarEcmaFormat() { Map<String, Object> props = getDeep(content, "jcr:content"); Calendar calendar = (Calendar) props.get("cq:lastModified"); assertNotNull(calendar);//w w w .j a v a 2 s.c o m calendar.setTimeZone(TimeZone.getTimeZone("GMT+2")); assertEquals(2014, calendar.get(Calendar.YEAR)); assertEquals(4, calendar.get(Calendar.MONTH) + 1); assertEquals(22, calendar.get(Calendar.DAY_OF_MONTH)); assertEquals(15, calendar.get(Calendar.HOUR_OF_DAY)); assertEquals(11, calendar.get(Calendar.MINUTE)); assertEquals(24, calendar.get(Calendar.SECOND)); }
From source file:com.flozano.socialauth.plugin.googleplus.FeedPluginImpl.java
public FeedPluginImpl(final ProviderSupport providerSupport) { this.providerSupport = providerSupport; dateFormat.setTimeZone(TimeZone.getTimeZone("UTC")); }
From source file:org.springframework.batch.admin.domain.JobExecutionInfoResource.java
public JobExecutionInfoResource() { this.timeZone = TimeZone.getTimeZone("UTC"); }
From source file:com.adobe.acs.commons.http.headers.impl.AbstractExpiresHeaderFilter.java
@Override protected String getHeaderValue() { Calendar next = Calendar.getInstance(); next.set(Calendar.HOUR_OF_DAY, expiresTime.get(Calendar.HOUR_OF_DAY)); next.set(Calendar.MINUTE, expiresTime.get(Calendar.MINUTE)); next.set(Calendar.SECOND, 0); adjustExpires(next);// w ww.j a v a 2s . c om SimpleDateFormat dateFormat = new SimpleDateFormat(EXPIRES_FORMAT); dateFormat.setTimeZone(TimeZone.getTimeZone("GMT")); return dateFormat.format(next.getTime()); }