public class TimestampHelper
extends java.sql.Timestamp
Modifier and Type | Field and Description |
---|---|
static java.lang.String | COPYRIGHT
IBM Copyright notice field.
|
static int | MILLIS_IN_SECOND
The number of milliseconds in a second (1000).
|
static int | SQL_TSI_SECOND
Has a value of 2.
|
Constructor and Description |
---|
TimestampHelper(int year, int month, int date, int hour, int minute, int second, int nano)
This is a constructor for this class.
|
TimestampHelper(long time)
This is a constructor for this class.
|
Modifier and Type | Method and Description |
---|---|
static java.sql.Timestamp | getCurrentTime()
This method returns the current date and time of the executing system as a timestamp value.
|
static java.sql.Timestamp | getCurrentTime(ActivityToken aToken)
This method returns a date.
|
static java.lang.String | getDateFromTimestamp(java.sql.Timestamp t)
This method extracts the date portion from the timestamp.
|
static java.lang.String | getDateFromTimestamp(java.sql.Timestamp t, java.util.Locale locale)
This method extracts the date portion from the timestamp.
|
static java.lang.String | getDateTimeFromTimestamp(java.sql.Timestamp t, java.util.Locale locale)
This method returns the date and time in a locale-specific format.
|
static java.lang.String | getDayFromTimestamp(java.sql.Timestamp t)
This method extracts the day portion from the timestamp.
|
static java.lang.String | getMonthFromTimestamp(java.sql.Timestamp t)
This method extracts the month portion from the timestamp.
|
static java.lang.String | getSQLCurrentTimestamp()
This method returns the SQL keyword for retrieving current timestamp.
|
static java.lang.String | getSQLSyntaxTimestampPlusInteger(java.util.List parameters, java.lang.String TimeStampAttribute, java.lang.String IntegerAttribute)
This method creates a parameterized SQL snippet to add an integer to a timestamp.
|
static java.lang.String | getSQLSyntaxTimestampPlusInteger(java.lang.String TimeStampAttribute, java.lang.String IntegerAttribute)
This method creates an SQL snippet to add an integer to a timestamp.
|
static java.lang.String | getTimeFromTimestamp(java.sql.Timestamp t)
This method extracts the time portion from the timestamp.
|
static java.lang.String | getTimeFromTimestampWithSeconds(java.sql.Timestamp t)
This method extracts the time with second portion from the timestamp.
|
static java.lang.String | getTimestampString(java.lang.String pattern, java.sql.Timestamp t)
This method convert a timestamp to its String representation using the input pattern.
|
static java.lang.String | getTimestampString(java.sql.Timestamp t)
This method converts a timestamp to its String representation using the pattern defined in the configuration file.
|
static java.lang.String | getYearFromTimestamp(java.sql.Timestamp t)
This method extracts the year portion from the timestamp.
|
static java.sql.Timestamp | now()
This method returns current date and time from database as a timestamp value.
|
static java.sql.Timestamp | parseDateTime(java.lang.String date, java.lang.String time)
This method converts the date (YYYY-MM-DD) and time (hh:mm) into a timestamp.
|
static java.sql.Timestamp | parseDateTime(java.lang.String year, java.lang.String month, java.lang.String day, java.lang.String time)
This method converts the date, 3 variables YYYY, MM and DD and time in the form hh:mm into a timestamp.
|
static java.sql.Timestamp | systemCurrentTimestamp()
This method returns current time of the executing system as a timestamp value.
|
static java.sql.Timestamp | timestampAdd(int interval, long numberOfIntervals, java.sql.Timestamp timestamp)
This method returns the timestamp calculated by adding numberOfIntervals to the timestamp.
|
static long | timestampDiff(int interval, java.sql.Timestamp timestamp1, java.sql.Timestamp timestamp2)
This method returns the number of intervals of type interval by which timestamp1 is greater than timestamp2.
|
static long | timestampDifference(int interval, java.sql.Timestamp timestamp1, java.sql.Timestamp timestamp2)
This method returns the number of intervals of type interval by which timestamp1 is greater than timestamp2.
|
public static final java.lang.String COPYRIGHT
public static final int SQL_TSI_SECOND
public static final int MILLIS_IN_SECOND
public TimestampHelper(int year, int month, int date, int hour, int minute, int second, int nano)
public TimestampHelper(long time)
public static java.sql.Timestamp getCurrentTime()
public static java.sql.Timestamp getCurrentTime(ActivityToken aToken)
public static java.lang.String getDateFromTimestamp(java.sql.Timestamp t)
public static java.lang.String getDateFromTimestamp(java.sql.Timestamp t, java.util.Locale locale)
public static java.lang.String getDateTimeFromTimestamp(java.sql.Timestamp t, java.util.Locale locale)
public static java.lang.String getDayFromTimestamp(java.sql.Timestamp t)
public static java.lang.String getMonthFromTimestamp(java.sql.Timestamp t)
public static java.lang.String getSQLCurrentTimestamp()
public static java.lang.String getSQLSyntaxTimestampPlusInteger(java.lang.String TimeStampAttribute, java.lang.String IntegerAttribute)
public static java.lang.String getSQLSyntaxTimestampPlusInteger(java.util.List parameters, java.lang.String TimeStampAttribute, java.lang.String IntegerAttribute)
public static java.lang.String getTimeFromTimestamp(java.sql.Timestamp t)
public static java.lang.String getTimeFromTimestampWithSeconds(java.sql.Timestamp t)
public static java.lang.String getTimestampString(java.lang.String pattern, java.sql.Timestamp t)
public static java.lang.String getTimestampString(java.sql.Timestamp t)
public static java.lang.String getYearFromTimestamp(java.sql.Timestamp t)
public static java.sql.Timestamp now()
public static java.sql.Timestamp parseDateTime(java.lang.String date, java.lang.String time)
public static java.sql.Timestamp parseDateTime(java.lang.String year, java.lang.String month, java.lang.String day, java.lang.String time)
public static java.sql.Timestamp systemCurrentTimestamp()
public static java.sql.Timestamp timestampAdd(int interval, long numberOfIntervals, java.sql.Timestamp timestamp)
public static long timestampDiff(int interval, java.sql.Timestamp timestamp1, java.sql.Timestamp timestamp2)
public static long timestampDifference(int interval, java.sql.Timestamp timestamp1, java.sql.Timestamp timestamp2)