LOG.info("MOB HFiles older than " + expireDate.toGMTString() + " will be deleted!");
Date expdate = new Date (); expdate.setTime (expdate.getTime() + (3600 * 1000)); String cookieExpire = "expires=" + expdate.toGMTString(); ...
@Override public String toString() { StringBuilder buf = new StringBuilder("QueryStats[query:"); buf.append(query); buf.append(", nrOfInvocations:"); buf.append(nrOfInvocations); buf.append(", maxInvocationTime:"); buf.append(maxInvocationTime); buf.append(", maxInvocationDate:"); buf.append(new java.util.Date(maxInvocationDate).toGMTString()); buf.append(", minInvocationTime:"); buf.append(minInvocationTime); buf.append(", minInvocationDate:"); buf.append(new java.util.Date(minInvocationDate).toGMTString()); buf.append(", totalInvocationTime:"); buf.append(totalInvocationTime); buf.append(", averageInvocationTime:"); buf.append((float)totalInvocationTime / (float)nrOfInvocations); buf.append(", failures:"); buf.append(failures); buf.append(", prepareCount:"); buf.append(prepareCount); buf.append(", prepareTime:"); buf.append(prepareTime); buf.append("]"); return buf.toString(); }
private void writeHttpExchange(RecordedHttpExchange recordedHttpExchanges) throws IOException { _jsonGenerator.writeStringField(SceneSerializationConstant.SCENE_TAG_UPDATE_TIME, recordedHttpExchanges.getUpdateTime().toGMTString()); _jsonGenerator.writeObjectFieldStart(SceneSerializationConstant.SCENE_TAG_HTTPREQUEST); writeHttpRequest(recordedHttpExchanges.getRecordedHttpRequest()); _jsonGenerator.writeEndObject(); _jsonGenerator.writeObjectFieldStart(SceneSerializationConstant.SCENE_TAG_HTTPRESPONSE); writeHttpResponse(recordedHttpExchanges.getRecordedHttpResponse()); _jsonGenerator.writeEndObject(); }
Headers hds = t.getResponseHeaders(); hds.set("Content-Type", contentType); hds.set("Last-Modified", new Date(lastModified).toGMTString()); t.sendResponseHeaders(200, length); responseFileContent(t, f);
/** * Convert an epoch time to a GMT time. This * uses the deprecated Date.toString() operation, * so is in one place to reduce the number of deprecation warnings. * @param time timestamp * @return string value as ISO-9601 */ @SuppressWarnings({"CallToDateToString", "deprecation"}) public static String toGMTString(long time) { return new Date(time).toGMTString(); }
private String dateInUTC(Date date) { if (date == null) { return "null"; } return date.toGMTString().replace("GMT","UTC"); }
public String dateInUTC(Date date) { if (date == null) { return "null"; } return date.toGMTString().replace("GMT","UTC"); } }
/** * Convert an epoch time to a GMT time. This * uses the deprecated Date.toString() operation, * so is in one place to reduce the number of deprecation warnings. * @param time timestamp * @return string value as ISO-9601 */ @SuppressWarnings({"CallToDateToString", "deprecation"}) public static String toGMTString(long time) { return new Date(time).toGMTString(); }
/** This method prints out the last time this index was updated as a String in GMT format **/ @SuppressWarnings("deprecation") public String getTimeOfLastUpdate() { currentCalendar.setTimeInMillis(lastUpdateTime); return currentCalendar.getTime().toGMTString(); }
SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS'Z'"); String dateStr = "2010-02-15T20:05:28.000Z"; try { Date date = format.parse(dateStr); System.out.println(date.toGMTString()); } catch (ParseException e) { e.printStackTrace(); }
@Test public void shouldParseDateCorrectly() throws Exception { // Given SimpleDateFormat format = new SimpleDateFormat("dd/MM/yyyy"); format.setTimeZone(TimeZone.getTimeZone("UTC")); // When Date parsedDate = format.parse("21/08/2012"); // Then Assert.assertThat(parsedDate.toString(), is("Tue Aug 21 02:00:00 CEST 2012")); Assert.assertThat(parsedDate.toGMTString(), is("21 Aug 2012 00:00:00 GMT")); }
//date.setTimeZone(TimeZone.getTimeZone("UTC")); <- remove it. date.set(Calendar.HOUR_OF_DAY, 0); GregorianCalendar utcCAL = (GregorianCalendar) GregorianCalendar.getInstance(TimeZone.getTimeZone("UTC")); utcCAL.setTimeInMillis(date.getTimeInMillis()); System.out.println(utcCAL.getTime().toGMTString() + " " + utcCAL.getTimeInMillis());
String ackwardDate = "/Date(1376841597000)/"; //Dirty convertion Calendar calendar = Calendar.getInstance(); String ackwardRipOff = ackwardDate.replace("/Date(", "").replace(")/", ""); Long timeInMillis = Long.valueOf(ackwardRipOff); calendar.setTimeInMillis(timeInMillis); System.out.println(calendar.getTime().toGMTString()); //Prints 18 Aug 2013 15:59:57 GMT
private static NameValuePair[] dynamicKeyValues() { return new NameValuePair[]{ nvp("client-time", (new Date()).toGMTString()) }; } private static final String UNDEFINED_VERSION = "";
//date.setTimeZone(TimeZone.getTimeZone("UTC")); date.set(Calendar.HOUR_OF_DAY, 0); Date utcDate = date.getTime(); utcDate.UTC(2014, 9, 1, 26, 1, 0); System.out.println(utcDate.toGMTString() + " " + date.getTimeInMillis());
@SuppressWarnings("deprecation") public String toGMTString() { Capturer.capture(Instrumenter.CAPTURE_ID_JAVA_UTIL_DATE, this, "toGMTString", "()Ljava/lang/String;", new Object[] {}); String ret = super.toGMTString(); Capturer.enable(Instrumenter.CAPTURE_ID_JAVA_UTIL_DATE, this, ret); return ret; }
@Test @SuppressWarnings("deprecation") public void testAppleMailPrependsZeroNotSpace() throws Exception { assertThat(DecoderUtils.decodeDateTime( "09-Apr-2008 15:17:51 +0200").toGMTString()).isEqualTo("9 Apr 2008 13:17:51 GMT"); }
@Test public void testGetTimeMillis() { // TODO(CK): netty bug? we can't call addTimeMillis() here headers.delegate().add("header", new Date(1514400000L).toGMTString()); assertEquals((Long) 1514400000L, headers.getTimeMillis("header")); }
@SuppressWarnings("deprecation") @Test public void testDate() throws Exception { Block block = PARAMS.getDefaultSerializer().makeBlock(blockBytes); assertEquals("4 Nov 2010 16:06:04 GMT", block.getTime().toGMTString()); }