public String getTimeSortKey() { if(lastChange==null) return "-"; return Util.XS_DATETIME_FORMATTER.format(lastChange.getTime()); }
public static String xsDate(Calendar cal) { return Util.XS_DATETIME_FORMATTER.format(cal.getTime()); }
public static String rfc822Date(Calendar cal) { return Util.RFC822_DATETIME_FORMATTER.format(cal.getTime()); }
/** * <p>Formats a millisecond <code>long</code> value.</p> * * @param millis the millisecond value to format * @return the formatted string * @since 2.1 */ public String format(long millis) { return format(new Date(millis)); }
/** * <p>Formats a milliseond <code>long</code> value into the * supplied <code>StringBuffer</code>.</p> * * @param millis the millisecond value to format * @param buf the buffer to format into * @return the specified string buffer * @since 2.1 */ public StringBuffer format(long millis, StringBuffer buf) { return format(new Date(millis), buf); }
/** * Returns the timestamp formatted in xs:dateTime. */ public @Nonnull String getTimestampString2() { return Util.XS_DATETIME_FORMATTER.format(new Date(timestamp)); }
public static String formatTime(long millis) { return format.format(millis); }
/** * <p>Formats a <code>Calendar</code> object.</p> * * @param calendar the calendar to format * @return the formatted string */ public String format(Calendar calendar) { return format(calendar, new StringBuffer(mMaxLengthEstimate)).toString(); }
/** * <p>Formats a <code>Date</code>, <code>Calendar</code> or * <code>Long</code> (milliseconds) object.</p> * * @param obj the object to format * @param toAppendTo the buffer to append to * @param pos the position - ignored * @return the buffer passed in */ public StringBuffer format(Object obj, StringBuffer toAppendTo, FieldPosition pos) { if (obj instanceof Date) { return format((Date) obj, toAppendTo); } else if (obj instanceof Calendar) { return format((Calendar) obj, toAppendTo); } else if (obj instanceof Long) { return format(((Long) obj).longValue(), toAppendTo); } else { throw new IllegalArgumentException("Unknown class: " + (obj == null ? "<null>" : obj.getClass().getName())); } }
String generateToken(String consumerAppId, Date generationTime, String consumerTokenSalt) { return Hashing.sha1().hashString(KEY_JOINER.join(consumerAppId, TIMESTAMP_FORMAT.format (generationTime), consumerTokenSalt), Charsets.UTF_8).toString(); }
/** * <p>Formats a date/time into a specific pattern in a time zone and locale.</p> * * @param date the date to format * @param pattern the pattern to use to format the date * @param timeZone the time zone to use, may be <code>null</code> * @param locale the locale to use, may be <code>null</code> * @return the formatted date */ public static String format(Date date, String pattern, TimeZone timeZone, Locale locale) { FastDateFormat df = FastDateFormat.getInstance(pattern, timeZone, locale); return df.format(date); }
/** * Gets the name of the index to use for an index request * @param indexPrefix * Prefix of index name to use -- as configured on the sink * @param timestamp * timestamp (millis) to format / use * @return index name of the form 'indexPrefix-formattedTimestamp' */ protected String getIndexName(String indexPrefix, long timestamp) { return new StringBuilder(indexPrefix).append('-') .append(fastDateFormat.format(timestamp)).toString(); }
/** * <p>Formats a calendar into a specific pattern in a time zone and locale.</p> * * @param calendar the calendar to format * @param pattern the pattern to use to format the calendar * @param timeZone the time zone to use, may be <code>null</code> * @param locale the locale to use, may be <code>null</code> * @return the formatted calendar * @see FastDateFormat#format(Calendar) * @since 2.4 */ public static String format(Calendar calendar, String pattern, TimeZone timeZone, Locale locale) { FastDateFormat df = FastDateFormat.getInstance(pattern, timeZone, locale); return df.format(calendar); }
public static String generate(Object... args){ String hexIdString = ByteUtil.toHexString(toByteArray(Objects.hash(args), MachineUtil.getMachineIdentifier(), counter.incrementAndGet())); return KEY_JOINER.join(TIMESTAMP_FORMAT.format(new Date()), hexIdString); }
private String renderReleaseBasicInfo(String template, Env env, ReleaseHistoryBO releaseHistory) { String renderResult = template; Map<String, Object> operationContext = releaseHistory.getOperationContext(); boolean isEmergencyPublish = operationContext.containsKey(ReleaseOperationContext.IS_EMERGENCY_PUBLISH) && (boolean) operationContext.get(ReleaseOperationContext.IS_EMERGENCY_PUBLISH); if (isEmergencyPublish) { renderResult = renderResult.replaceAll(EMAIL_CONTENT_FIELD_EMERGENCY_PUBLISH, Matcher.quoteReplacement(EMERGENCY_PUBLISH_TAG)); } else { renderResult = renderResult.replaceAll(EMAIL_CONTENT_FIELD_EMERGENCY_PUBLISH, ""); } renderResult = renderResult.replaceAll(EMAIL_CONTENT_FIELD_APPID, Matcher.quoteReplacement(releaseHistory.getAppId())); renderResult = renderResult.replaceAll(EMAIL_CONTENT_FIELD_ENV, Matcher.quoteReplacement(env.toString())); renderResult = renderResult.replaceAll(EMAIL_CONTENT_FIELD_CLUSTER, Matcher.quoteReplacement(releaseHistory.getClusterName())); renderResult = renderResult.replaceAll(EMAIL_CONTENT_FIELD_NAMESPACE, Matcher.quoteReplacement(releaseHistory.getNamespaceName())); renderResult = renderResult.replaceAll(EMAIL_CONTENT_FIELD_OPERATOR, Matcher.quoteReplacement(releaseHistory.getOperator())); renderResult = renderResult.replaceAll(EMAIL_CONTENT_FIELD_RELEASE_TITLE, Matcher.quoteReplacement(releaseHistory.getReleaseTitle())); renderResult = renderResult.replaceAll(EMAIL_CONTENT_FIELD_RELEASE_ID, String.valueOf(releaseHistory.getReleaseId())); renderResult = renderResult.replaceAll(EMAIL_CONTENT_FIELD_RELEASE_HISTORY_ID, String.valueOf(releaseHistory.getId())); renderResult = renderResult.replaceAll(EMAIL_CONTENT_FIELD_RELEASE_COMMENT, Matcher.quoteReplacement(releaseHistory.getReleaseComment())); renderResult = renderResult.replaceAll(EMAIL_CONTENT_FIELD_APOLLO_SERVER_ADDRESS, getApolloPortalAddress()); return renderResult .replaceAll(EMAIL_CONTENT_FIELD_RELEASE_TIME, dateFormat.format(releaseHistory.getReleaseTime())); }
/** * Gets the name of the index to use for an index request * @param event * Event for which the name of index has to be prepared * @return index name of the form 'indexPrefix-formattedTimestamp' */ @Override public String getIndexName(Event event) { TimestampedEvent timestampedEvent = new TimestampedEvent(event); long timestamp = timestampedEvent.getTimestamp(); String realIndexPrefix = BucketPath.escapeString(indexPrefix, event.getHeaders()); return new StringBuilder(realIndexPrefix).append('-') .append(fastDateFormat.format(timestamp)).toString(); }
return (months <= 0 ? 1 : months) + ONE_MONTH_AGO; } else { return TIMESTAMP_FORMAT.format(date);
TIMESTAMP_FORMAT.format(new Date()) + "-master-rollback-merge-to-gray", "", childNamespaceNewConfiguration, parentNamespaceNewLatestRelease.getId(), operator, ReleaseOperation.MATER_ROLLBACK_MERGE_TO_GRAY, false, branchReleaseKeys);
private PublishMsg buildPublishMsg(Env env, ReleaseHistoryBO releaseHistory) { PublishMsg msg = new PublishMsg(); msg.setPriority("中"); msg.setTool_origin("Apollo"); String appId = releaseHistory.getAppId(); App app = appService.load(appId); msg.setInfluence_bu(app.getOrgName()); msg.setAppid(appId); msg.setAssginee(releaseHistory.getOperator()); msg.setOperation_time(TIMESTAMP_FORMAT.format(releaseHistory.getReleaseTime())); msg.setDesc(gson.toJson(releaseService.compare(env, releaseHistory.getPreviousReleaseId(), releaseHistory.getReleaseId()))); return msg; }
@Override protected void calculate(Run<?,?> build, JSONObject element) { BallColor iconColor = build.getIconColor(); element.put("iconColorOrdinal", iconColor.ordinal()); element.put("iconColorDescription", iconColor.getDescription()); element.put("url", build.getUrl()); element.put("buildStatusUrl", build.getBuildStatusUrl()); element.put("parentUrl", build.getParent().getUrl()); element.put("parentFullDisplayName", Functions.breakableString(Functions.escape(build.getParent().getFullDisplayName()))); element.put("displayName", build.getDisplayName()); element.put("timestampString", build.getTimestampString()); element.put("timestampString2", build.getTimestampString2()); element.put("timestampString3", Util.XS_DATETIME_FORMATTER.format(new Date(build.getStartTimeInMillis()))); Run.Summary buildStatusSummary = build.getBuildStatusSummary(); element.put("buildStatusSummaryWorse", buildStatusSummary.isWorse); element.put("buildStatusSummaryMessage", buildStatusSummary.message); }