|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--java.util.Date | +--java.sql.Timestamp | +--com.ibm.commerce.utils.TimestampHelper
TimestampHelper class contains helper methods for manipulating timestamps
Field Summary | |
static int |
MILLIS_IN_SECOND
|
static int |
SQL_TSI_SECOND
|
Constructor Summary | |
TimestampHelper(int year,
int month,
int date,
int hour,
int minute,
int second,
int nano)
TimestampHelper constructor. |
|
TimestampHelper(long time)
TimestampHelper constructor. |
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 |
getTimeFromTimestamp(java.sql.Timestamp t)
Will extract the time portion from the timestamp The date will be returned as follows hh:mm in 24 hour form |
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, equals, equals, getDate, getHours, getMinutes, getMonth, getNanos, getSeconds, getYear, setNanos, toString, valueOf |
Methods inherited from class java.util.Date |
after, before, clone, compareTo, compareTo, getDay, getTime, getTimezoneOffset, hashCode, parse, setDate, setHours, setMinutes, setMonth, setSeconds, setTime, setYear, toGMTString, toLocaleString, UTC |
Methods inherited from class java.lang.Object |
finalize, getClass, notify, notifyAll, wait, wait, wait |
Field Detail |
public static final int MILLIS_IN_SECOND
public static final int SQL_TSI_SECOND
Constructor Detail |
public TimestampHelper(int year, int month, int date, int hour, int minute, int second, int nano)
year
- intmonth
- intdate
- inthour
- intminute
- intsecond
- intnano
- intpublic TimestampHelper(long time)
time
- longMethod Detail |
public static java.sql.Timestamp getCurrentTime()
public static java.lang.String getDateFromTimestamp(java.sql.Timestamp t)
t
- Timestamp to parsepublic static java.lang.String getDateFromTimestamp(java.sql.Timestamp t, java.util.Locale locale)
t
- Timestamp to parselocale
- Locale to use for displaypublic static java.lang.String getDateTimeFromTimestamp(java.sql.Timestamp t, java.util.Locale locale)
t
- Timestamp to parselocale
- Locale to use for displaypublic static java.lang.String getDayFromTimestamp(java.sql.Timestamp t)
t
- Timestamp to parsepublic static java.lang.String getMonthFromTimestamp(java.sql.Timestamp t)
t
- Timestamp to parsepublic static java.lang.String getSQLCurrentTimestamp()
public static java.lang.String getTimeFromTimestamp(java.sql.Timestamp t)
t
- Timestamp to parsepublic static java.lang.String getTimestampString(java.lang.String pattern, java.sql.Timestamp t)
pattern
- String - time stamp pattern to be usedt
- Timestamp to parsepublic static java.lang.String getTimestampString(java.sql.Timestamp t)
t
- Timestamp to parsepublic static java.lang.String getYearFromTimestamp(java.sql.Timestamp t)
t
- Timestamp to parsepublic static java.sql.Timestamp now()
public static java.sql.Timestamp parseDateTime(java.lang.String date, java.lang.String time)
date
- Date to use to create timestamptime
- Time to use to create timestamppublic static java.sql.Timestamp parseDateTime(java.lang.String year, java.lang.String month, java.lang.String day, java.lang.String time)
date
- Date to use to create timestamptime
- Time to use to create timestamppublic static java.sql.Timestamp systemCurrentTimestamp()
public static java.sql.Timestamp timestampAdd(int interval, long numberOfIntervals, java.sql.Timestamp timestamp)
interval
- keyword to represent unit of time such as second, minute.numberOfIntervals
- number of units of timetimestamp
- the base timestamppublic static long timestampDiff(int interval, java.sql.Timestamp timestamp1, java.sql.Timestamp timestamp2)
interval
- keyword to represent unit of time such as second, minutetimestamp1
- java.sql.Timestamptimestamp2
- java.sql.Timestamp
|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |