org.teiid.core.util
Class TimestampWithTimezone

java.lang.Object
  extended by org.teiid.core.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.


Constructor Summary
TimestampWithTimezone()
           
 
Method Summary
static Object create(Date date, TimeZone initial, Calendar target, Class<?> type)
           
static Date createDate(Date date)
          Creates normalized SQL Date Object
static Date createDate(Date date, TimeZone initial, Calendar target)
           
static Time createTime(Date date)
          Creates normalized SQL Time Object
static Time createTime(Date date, TimeZone initial, Calendar target)
           
static Timestamp createTimestamp(Date date)
           
static Timestamp createTimestamp(Date date, TimeZone 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
 

Constructor Detail

TimestampWithTimezone

public TimestampWithTimezone()
Method Detail

getCalendar

public static Calendar getCalendar()

resetCalendar

public static void resetCalendar(TimeZone tz)

create

public static Object create(Date date,
                            TimeZone initial,
                            Calendar target,
                            Class<?> type)

createTimestamp

public static Timestamp createTimestamp(Date date,
                                        TimeZone initial,
                                        Calendar target)

createTime

public static Time createTime(Date date,
                              TimeZone initial,
                              Calendar target)

createDate

public static Date createDate(Date date,
                              TimeZone initial,
                              Calendar target)

createTime

public static Time createTime(Date date)
Creates normalized SQL Time Object

Returns:
Time
Since:
4.3

createDate

public static Date createDate(Date date)
Creates normalized SQL Date Object

Returns:
Date
Since:
4.3

createTimestamp

public static Timestamp createTimestamp(Date date)


Copyright © 2012. All Rights Reserved.