com.simba.dsi.utilities
Class CalendarSetter

java.lang.Object
  extended by com.simba.dsi.utilities.CalendarSetter

public class CalendarSetter
extends java.lang.Object

This utility class is used to set Date, Time, and Timestamp objects to the timezone given in a calendar.


Constructor Summary
CalendarSetter()
           
 
Method Summary
static java.sql.Date getDate(java.sql.Date date, java.util.Calendar cal)
          Returns a Date object set to the timezone of the given calendar.
static java.sql.Time getTime(java.sql.Time time, java.util.Calendar cal)
          Returns a Time object set to the timezone of the given calendar.
static java.sql.Time getTime(java.sql.Time time, java.util.Calendar to, java.util.Calendar from)
          Returns a Time object set to the timezone of the given calendar.
static java.sql.Timestamp getTimestamp(java.sql.Timestamp timestamp, java.util.Calendar cal)
          Returns a Timestamp object set to the timezone of the given calendar.
static java.sql.Timestamp getTimestamp(java.sql.Timestamp timestamp, java.util.Calendar to, java.util.Calendar from)
          Returns a Timestamp object set to the timezone of the given calendar.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CalendarSetter

public CalendarSetter()
Method Detail

getDate

public static java.sql.Date getDate(java.sql.Date date,
                                    java.util.Calendar cal)
Returns a Date object set to the timezone of the given calendar. The Date input must be created with the default JVM timezone.

Parameters:
date - The Date object to set.
cal - The java.util.Calendar object to use in constructing the date.
Returns:
The new Date object, or null if a null date is passed in.

getTime

public static java.sql.Time getTime(java.sql.Time time,
                                    java.util.Calendar cal)
Returns a Time object set to the timezone of the given calendar. The Time input must be created with the default JVM timezone.

Parameters:
time - The Time object to set.
cal - The java.util.Calendar object to use in constructing the date.
Returns:
The new Time object, or null if a null Time is passed in.

getTime

public static java.sql.Time getTime(java.sql.Time time,
                                    java.util.Calendar to,
                                    java.util.Calendar from)
Returns a Time object set to the timezone of the given calendar. The Time input must be created with the default JVM timezone.

Parameters:
time - The Time object to set.
to - The java.util.Calendar object to use in constructing the converted time. Cannot be null.
from - The original calendar that was used to construct the time. Cannot be null.
Returns:
The new Time object, or null if a null Time is passed in.

getTimestamp

public static java.sql.Timestamp getTimestamp(java.sql.Timestamp timestamp,
                                              java.util.Calendar cal)
Returns a Timestamp object set to the timezone of the given calendar. The Timestamp input must be created with the default JVM timezone.

Parameters:
timestamp - The Timestamp object to set.
cal - The java.util.Calendar object to use in constructing the date.
Returns:
The new Timestamp object, or null if a null Timestamp was passed in.

getTimestamp

public static java.sql.Timestamp getTimestamp(java.sql.Timestamp timestamp,
                                              java.util.Calendar to,
                                              java.util.Calendar from)
Returns a Timestamp object set to the timezone of the given calendar. The Timestamp input must be created with the default JVM timezone.

Parameters:
timestamp - The Timestamp object to set.
to - The java.util.Calendar object to use in constructing the converted Date. Cannot be null.
from - The Calendar object used to create the input Date. Cannot be null.
Returns:
The new Timestamp object, or null if a null Timestamp was passed in.


Copyright © 2006-2014 Simba Technologies Incorporated. All Rights Reserved.