Java Utililty Methods Timestamp Now

List of utility methods to do Timestamp Now

Description

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

Method

TimestampgetCurrentTimeStamp(int offsetDays)
get Current Time Stamp
Timestamp ts = new Timestamp(System.currentTimeMillis());
Calendar calendar = GregorianCalendar.getInstance();
calendar.setTime(ts);
calendar.add(Calendar.DAY_OF_YEAR, offsetDays);
ts.setTime(calendar.getTime().getTime());
return new Timestamp(calendar.getTime().getTime());
StringgetCurrentTimeStamp(String format)
get Current Time Stamp
SimpleDateFormat f = new SimpleDateFormat(format);
String timeStamp = f.format(new Date());
return timeStamp;
StringgetCurrentTimestampAsString()
get Current Timestamp As String
return getCurrentTimestamp().toString();
longgetNowTimeStamp()
get Now Time Stamp
long returnTimeStamp = 0;
Date aDate = null;
try {
    aDate = convertStringToDate("yyyy-MM-dd HH:mm:ss", getNowDateTime());
} catch (ParseException pe) {
    aDate = null;
if (aDate == null) {
...
java.sql.TimestampgetTimestamp()
get Timestamp
return new java.sql.Timestamp(new java.util.Date().getTime());
TimestampgetTimestamp()
Return the actual time
return new Timestamp(Calendar.getInstance().getTimeInMillis());
TimestampgetTimestamp()
get Timestamp
return new Timestamp(getTime());
TimestampgetTimestamp()
Creates a java.sql.Timestamp from now.
return getTimestamp(new Date());
TimestampgetTimestamp()
get Timestamp
return toTimestamp(getSqlDate());
StringgetTimeStamp()
get Time Stamp
Timestamp timestamp = new Timestamp(System.currentTimeMillis());
Date date = new Date(timestamp.getTime());
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("MM/dd/yyyy' 'HH:MM:ss:S");
return simpleDateFormat.format(timestamp);