Java Utililty Methods Timestamp Create

List of utility methods to do Timestamp Create

Description

The list of methods to do Timestamp Create are organized into topic(s).

Method

StringcreateEtag(String cookieId, Date timestamp)
create Etag
StringBuilder sb = new StringBuilder("\"");
sb.append(cookieId);
sb.append("/");
sb.append(fmt.format(timestamp));
sb.append("\"");
return sb.toString();
StringcreateTimeStamp()
Creates an auto ingest time stamp suffix using the current time.
return dateFormat.format(Calendar.getInstance().getTime());
StringcreateTimestamp()
Returns current timestamp as xs:Date format.
Date date = new Date();
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ssZ");
String formattedDate = sdf.format(date);
return formattedDate;
StringcreateTimeStamp()
Creates a timestamp string
SimpleDateFormat fmt = new SimpleDateFormat("yyyy_MM_dd_HH_mm_ss");
Date date = new Date(System.currentTimeMillis());
return fmt.format(date);
StringcreateTimeStamp()
create Time Stamp
long millisSince1970 = System.currentTimeMillis();
return getFormattedTimeStamp(millisSince1970);
TimestampcreateTimestamp(final int aYear, final int aMonth, final int aDate, final int aHour, final int aMinute, final int aSecond)
create Timestamp
Calendar c = Calendar.getInstance();
c.set(aYear, aMonth, aDate, aHour, aMinute, aSecond);
return new Timestamp(c.getTimeInMillis());
TimestampcreateTimestamp(final int year, final int month, final int day, final int hour, final int minute, final int second)
create Timestamp
return new Timestamp(createCalendar(year, month, day, hour, minute, second).getTimeInMillis());
TimestampcreateTimestamp(int month, int day)
create Timestamp
Calendar c = Calendar.getInstance();
c.set(c.get(Calendar.YEAR), month - 1, day, 0, 0, 0);
c.set(Calendar.MILLISECOND, 0);
return new Timestamp(c.getTimeInMillis());
StringcreateTimestampedZipFilename(String prefix)
create Timestamped Zip Filename
StringBuilder sb = new StringBuilder(prefix);
sb.append("-");
sb.append(DATE_FORMATTER.get().format(new Date()));
sb.append(".zip");
return sb.toString();
SimpleDateFormatcreateTimestampFormat()
create Timestamp Format
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss");
GregorianCalendar calendar = new GregorianCalendar(TimeZone.getTimeZone("UTC"));
calendar.setGregorianChange(new Date(Long.MIN_VALUE));
sdf.setCalendar(calendar);
return sdf;