org.modeshape.jdbc.util
Class TimestampWithTimezone

java.lang.Object
  extended by org.modeshape.jdbc.util.TimestampWithTimezone

public class TimestampWithTimezone
extends Object

Utility methods for SQL Timestamps, Time, and Dates with time zones as UTC This is intended to take incoming Strings or Dates that have accurate Calendar fields and give the UTC time by interpretting those fields in the target time zone. Use of the Calendar object passed in will not be thread safe, but it will not alter the contents of the Calendar. Note that normalization occurs only for the transition from one type to another.


Field Summary
static DateFormat DATE_FORMAT
           
static DateFormat DATETIME_FORMAT
           
static DateFormat TIME_FORMAT
           
 
Constructor Summary
TimestampWithTimezone()
           
 
Method Summary
static Date createDate(Calendar target)
          Creates normalized SQL Date Object based on the target Calendar
static Date createDate(Calendar initial, Calendar target)
           
static Time createTime(Calendar target)
          Creates normalized SQL Time Object based on the target Calendar.
static Time createTime(Calendar initial, Calendar target)
           
static Timestamp createTimestamp(Calendar target)
          Creates normalized SQL Timestamp Object based on the target Calendar
static Timestamp createTimestamp(Calendar initial, Calendar target)
           
static Calendar getCalendar()
           
static void resetCalendar(TimeZone tz)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DATETIME_FORMAT

public static DateFormat DATETIME_FORMAT

DATE_FORMAT

public static DateFormat DATE_FORMAT

TIME_FORMAT

public static DateFormat TIME_FORMAT
Constructor Detail

TimestampWithTimezone

public TimestampWithTimezone()
Method Detail

getCalendar

public static Calendar getCalendar()

resetCalendar

public static void resetCalendar(TimeZone tz)

createTimestamp

public static Timestamp createTimestamp(Calendar initial,
                                        Calendar target)

createTime

public static Time createTime(Calendar initial,
                              Calendar target)

createDate

public static Date createDate(Calendar initial,
                              Calendar target)

createTime

public static Time createTime(Calendar target)
Creates normalized SQL Time Object based on the target Calendar.

Parameters:
target - Calendar
Returns:
Time

createDate

public static Date createDate(Calendar target)
Creates normalized SQL Date Object based on the target Calendar

Parameters:
target - Calendar
Returns:
Date

createTimestamp

public static Timestamp createTimestamp(Calendar target)
Creates normalized SQL Timestamp Object based on the target Calendar

Parameters:
target - Calendar
Returns:
Timestamp


Copyright © 2008-2011 JBoss, a division of Red Hat. All Rights Reserved.