java.lang.Objectjava.util.Date
java.sql.Timestamp
com.ibm.commerce.utils.TimestampHelper
TimestampHelper class contains helper methods for manipulating timestamps
Field Summary | |
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 Summary | |
TimestampHelper(int year, int month, int date, int hour, int minute, int second, int nano) Creates a timestamp helper object based on the parameters specified. |
|
TimestampHelper(long time) Creates the timestamp helper object based on the given time in long format. |
Method Summary | |
static java.sql.Timestamp | getCurrentTime() Returns current date and time of the executing system as a timestamp value. |
static java.lang.String | getDateFromTimestamp(java.sql.Timestamp t) Will extract the date portion from the timestamp The date will be returned as follows YYYY-MM-DD. |
static java.lang.String | getDateFromTimestamp(java.sql.Timestamp t, java.util.Locale locale) Will extract the date portion from the timestamp The date will be returned in a locale specific manner. |
static java.lang.String | getDateTimeFromTimestamp(java.sql.Timestamp t, java.util.Locale locale) The date and time will be returned in a locale specific format |
static java.lang.String | getDayFromTimestamp(java.sql.Timestamp t) Will extract the day portion from the timestamp. |
static java.lang.String | getMonthFromTimestamp(java.sql.Timestamp t) Will extract the month portion from the timestamp. |
static java.lang.String | getSQLCurrentTimestamp() 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) 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) Creates SQL snippet to add an integer to a timestamp. |
static java.lang.String | getTimeFromTimestamp(java.sql.Timestamp t) Will extract the time portion from the timestamp. |
static java.lang.String | getTimestampString(java.lang.String pattern, java.sql.Timestamp t) Convert a timestamp to its string representation using the input pattern. |
static java.lang.String | getTimestampString(java.sql.Timestamp t) Convert a timestamp to its string representation using the pattern defined in the config file. |
static java.lang.String | getYearFromTimestamp(java.sql.Timestamp t) Will extract the year portion from the timestamp. |
static java.sql.Timestamp | now() Returns current date and time from database as a timestamp value. |
static java.sql.Timestamp | parseDateTime(java.lang.String date, java.lang.String time) Will convert 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) Will convert the date, 3 vars YYYY, MM and DD and time in the form hh:mm into a timestamp. |
static java.sql.Timestamp | systemCurrentTimestamp() Returns current date and time of the executing system as a timestamp value. |
static java.sql.Timestamp | timestampAdd(int interval, long numberOfIntervals, java.sql.Timestamp timestamp) Returns the timestamp calculated by adding numberOfIntervals intervals to timestamp. |
static long | timestampDiff(int interval, java.sql.Timestamp timestamp1, java.sql.Timestamp timestamp2) Returns the number of intervals of type interval by which timestamp1 is greater than timestamp2. |
Methods inherited from class java.sql.Timestamp |
after, before, compareTo, compareTo, equals, equals, getNanos, getTime, setNanos, setTime, toString, valueOf |
Methods inherited from class java.util.Date |
after, before, clone, compareTo, getDate, getDay, getHours, getMinutes, getMonth, getSeconds, getTimezoneOffset, getYear, hashCode, parse, setDate, setHours, setMinutes, setMonth, setSeconds, setYear, toGMTString, toLocaleString, UTC |
Methods inherited from class java.lang.Object |
finalize, getClass, notify, notifyAll, wait, wait, wait |
Field Detail |
public static final java.lang.String COPYRIGHT
public static final int SQL_TSI_SECOND
public static final int MILLIS_IN_SECOND
Constructor Detail |
public TimestampHelper(int year, int month, int date, int hour, int minute, int second, int nano)
public TimestampHelper(long time)
Method Detail |
public static java.sql.Timestamp getCurrentTime()
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 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)
(C) Copyright IBM Corporation 1996, 2005. All Rights Reserved.