Package microsoft.sql
Class DateTimeOffset
java.lang.Object
microsoft.sql.DateTimeOffset
- All Implemented Interfaces:
Serializable
,Comparable<DateTimeOffset>
public final class DateTimeOffset
extends Object
implements Serializable, Comparable<DateTimeOffset>
Represents the SQL Server DATETIMEOFFSET data type.
The DateTimeOffset class represents a java.sql.Timestamp, including fractional seconds, plus an integer representing
the number of minutes offset from GMT.
- See Also:
- Serialized Form
-
Method Summary
Modifier and TypeMethodDescriptionint
compareTo(DateTimeOffset other)
Compares this DateTimeOffset object with another DateTimeOffset object to determine their relative order.boolean
int
Returns this DateTimeOffset object's offset value.Returns OffsetDateTime equivalent to this DateTimeOffset object.Returns this DateTimeOffset object's timestamp value.int
hashCode()
toString()
Formats a datetimeoffset as yyyy-mm-dd hh:mm:ss[.fffffffff] [+|-]hh:mm, where yyyy-mm-dd hh:mm:ss[.fffffffff] indicates a timestamp that is offset from UTC by the number of minutes indicated by [+|-]hh:mm.static DateTimeOffset
Converts a java.sql.Timestamp value with an integer offset to the equivalent DateTimeOffset valuestatic DateTimeOffset
Converts a java.sql.Timestamp value with a Calendar value to the equivalent DateTimeOffset value
-
Method Details
-
valueOf
Converts a java.sql.Timestamp value with an integer offset to the equivalent DateTimeOffset value- Parameters:
timestamp
- A java.sql.Timestamp valueminutesOffset
- An integer offset in minutes- Returns:
- The DateTimeOffset value of the input timestamp and minutesOffset
-
valueOf
Converts a java.sql.Timestamp value with a Calendar value to the equivalent DateTimeOffset value- Parameters:
timestamp
- A java.sql.Timestamp valuecalendar
- A java.util.Calendar value- Returns:
- The DateTimeOffset value of the input timestamp and calendar
-
toString
Formats a datetimeoffset as yyyy-mm-dd hh:mm:ss[.fffffffff] [+|-]hh:mm, where yyyy-mm-dd hh:mm:ss[.fffffffff] indicates a timestamp that is offset from UTC by the number of minutes indicated by [+|-]hh:mm. -
equals
-
hashCode
public int hashCode() -
getTimestamp
Returns this DateTimeOffset object's timestamp value.The returned value represents an instant in time as the number of milliseconds since January 1, 1970, 00:00:00 GMT.
- Returns:
- this DateTimeOffset object's timestamp component
-
getOffsetDateTime
Returns OffsetDateTime equivalent to this DateTimeOffset object.- Returns:
- OffsetDateTime equivalent to this DateTimeOffset object.
-
getMinutesOffset
public int getMinutesOffset()Returns this DateTimeOffset object's offset value.- Returns:
- this DateTimeOffset object's minutes offset from GMT
-
compareTo
Compares this DateTimeOffset object with another DateTimeOffset object to determine their relative order.The ordering is based on the timestamp component only. The offset component is not compared. Two DateTimeOffset objects are considered equivalent with respect to ordering as long as they represent the same moment in time, regardless of the location of the event. This is how SQL Server orders DATETIMEOFFSET values.
- Specified by:
compareTo
in interfaceComparable<DateTimeOffset>
- Returns:
- a negative integer, zero, or a positive integer as this DateTimeOffset is less than, equal to, or greater than the specified DateTimeOffset.
-