GlobalDateTime
open class GlobalDateTime : DataValue
Represents the XML Schema dateTime type with zone offset.
-
Time zone constant for GMT.
Declaration
Swift
public static let GMT: TimeZone
-
Declaration
Swift
public func utc() -> Date
Return Value
This global date/time value converted to UTC-based point in time.
-
Declaration
Swift
public static func from(utc dateTime: Date, in timeZone: TimeZone = GMT) -> GlobalDateTime
Parameters
utc
UTC-based point in time.
timeZone
Time zone in which the global date/time will be determined (defaults to GMT). Use
TimeZone.current
for the local time zone.Return Value
Global date/time equivalent of UTC-based point in time.
-
Compare two dateTime values.
Declaration
Swift
open class func compare(_ left: GlobalDateTime, _ right: GlobalDateTime) -> Int
Parameters
left
The first dateTime for comparison.
right
The second dateTime for comparison.
Return Value
-1 if
left < right
, 0 ifleft == right
, or 1 ifleft > right
. -
Compare this dateTime with another dateTime.
Declaration
Swift
open func compareTo(_ value: GlobalDateTime) -> Int
Parameters
value
The other dateTime value.
Return Value
-1 if this dateTime is less than the value dateTime, 0 if they are equal, 1 if this dateTime is greater than the value dateTime.
-
Data type of the wrapped value.
Declaration
Swift
override open var dataType: DataType { get }
-
Local date component of dateTime.
Declaration
Swift
open var date: LocalDate { get }
-
Day field of date (1 to 31).
Declaration
Swift
open var day: Int { get }
-
Day of week (1 to 7).
See also
DayOfWeek
.Declaration
Swift
open var dayOfWeek: Int { get }
-
Day of year (1 to 366).
Declaration
Swift
open var dayOfYear: Int { get }
-
Compare two dateTime values.
Declaration
Swift
open class func equal(_ left: GlobalDateTime?, _ right: GlobalDateTime?) -> Bool
Parameters
left
The first dateTime for comparison.
right
The second dateTime for comparison.
Return Value
true
ifleft
is equal toright
, otherwisefalse
. -
Compare this dateTime value with another dateTime value.
Declaration
Swift
override open func equals(_ other: AnyObject?) -> Bool
Parameters
other
The other dateTime value.
Return Value
True, if this dateTime value is equal to the value dateTime value. Otherwise
false
. -
Compare this dateTime value with another dateTime value.
Declaration
Swift
open func greaterEqual(_ value: GlobalDateTime) -> Bool
Parameters
value
The other dateTime value.
Return Value
true
if this dateTime value is greater than or equal to the value dateTime value. Oherwisefalse
. -
Compare two dateTime values.
Declaration
Swift
open class func greaterEqual(_ left: GlobalDateTime, _ right: GlobalDateTime) -> Bool
Parameters
left
The first dateTime for comparison.
right
The second dateTime for comparison.
Return Value
true
ifleft
is greater than or equal toright
, otherwisefalse
. -
Compare this dateTime value with another dateTime value.
Declaration
Swift
open func greaterThan(_ value: GlobalDateTime) -> Bool
Parameters
value
The other dateTime value.
Return Value
true
if this dateTime value is greater than the value dateTime value. Oherwisefalse
. -
Compare two dateTime values.
Declaration
Swift
open class func greaterThan(_ left: GlobalDateTime, _ right: GlobalDateTime) -> Bool
Parameters
left
The first dateTime for comparison.
right
The second dateTime for comparison.
Return Value
true
ifleft
is greater thanright
, otherwisefalse
. -
Hash this data value to a number.
Declaration
Swift
override open func hashCode() -> Int
Return Value
Any value in the range of type
int
. -
Hour field of time (0 to 23).
Declaration
Swift
open var hour: Int { get }
-
Compare this dateTime value with another dateTime value.
Declaration
Swift
open func lessEqual(_ value: GlobalDateTime) -> Bool
Parameters
value
The other dateTime value.
Return Value
true
if this dateTime value is less than or equal to the value dateTime value. Oherwisefalse
. -
Compare two dateTime values.
Declaration
Swift
open class func lessEqual(_ left: GlobalDateTime, _ right: GlobalDateTime) -> Bool
Parameters
left
The first dateTime for comparison.
right
The second dateTime for comparison.
Return Value
true
ifleft
is less than or equal toright
, otherwisefalse
. -
Compare this dateTime value with another dateTime value.
Declaration
Swift
open func lessThan(_ value: GlobalDateTime) -> Bool
Parameters
value
The other dateTime value.
Return Value
true
if this dateTime value is less than the value dateTime value. Oherwisefalse
. -
Compare two dateTime values.
Declaration
Swift
open class func lessThan(_ left: GlobalDateTime, _ right: GlobalDateTime) -> Bool
Parameters
left
The first dateTime for comparison.
right
The second dateTime for comparison.
Return Value
true
ifleft
is less thanright
, otherwisefalse
. -
Declaration
Swift
open class func literal(_ text: String) -> GlobalDateTime
Parameters
text
Value in XML Schema format.
Return Value
Value parsed from XML Schema format (with zone offset), or panic if
text
has invalid dateTime format. Useparse
if thetext
is not guaranteed to be in the correct format. -
Declaration
Swift
open class func millisBetween(a: GlobalDateTime, b: GlobalDateTime) -> Int64
Parameters
a
The first dateTime value.
b
The second dateTime value.
Return Value
The difference in milliseconds between two dateTime values
a
andb
, calculated asb - a
. -
Declaration
Swift
open func minus(_ value: GlobalDateTime) -> Double
Parameters
value
The other dateTime value.
Return Value
The difference
this - value
, measured in days. -
Minute field of time (0 to 59).
Declaration
Swift
open var minute: Int { get }
-
Month field of date (1 to 12).
See also
MonthOfYear
.Declaration
Swift
open var month: Int { get }
-
Nanosecond field of time (0 to 999999999).
Declaration
Swift
open var nano: Int { get }
-
Normalize this dateTime value to UTC. For example “2000-01-01T14:00:00+12:00” would normalize to “2000-01-01T02:00:00Z”
Declaration
Swift
open func normalize() -> GlobalDateTime
Return Value
An equivalent value with all fields normalized (adjusted) to UTC, such that
offset
is zero. -
Compare this dateTime value with another dateTime value.
Declaration
Swift
open func notEqual(_ value: GlobalDateTime) -> Bool
Parameters
value
The other dateTime value.
Return Value
true
if this dateTime value is not equal to the value dateTime value. Oherwisefalse
. -
Compare two dateTime values.
Declaration
Swift
open class func notEqual(_ left: GlobalDateTime?, _ right: GlobalDateTime?) -> Bool
Parameters
left
The first dateTime for comparison.
right
The second dateTime for comparison.
Return Value
true
ifleft
is not equal toright
, otherwisefalse
. -
Declaration
Swift
open class func now() -> GlobalDateTime
Return Value
The current global dateTime.
-
Declaration
Swift
open class func of(year: Int, month: Int, day: Int, hour: Int, minute: Int, second: Int, nano: Int = (0 as Int)) -> GlobalDateTime
Parameters
year
The year field.
month
The month field (1 to 12).
day
The day field (1 to 31).
hour
The hour field (0 to 23).
minute
The minute field (0 to 59).
second
The second field (0 to 59).
nano
The nano field (0 to 999999999).
Return Value
A new dateTime value.
-
Convert a Julian day number to a global date/time.
Declaration
Swift
open class func ofJulian(day: Double) -> GlobalDateTime
Parameters
day
Julian day number.
Return Value
Global date/time, with microsecond precision.
-
Time zone offset in minutes (-840 to 840).
Declaration
Swift
open var offset: Int { get }
-
Declaration
Swift
open class func parse(_ text: String) -> GlobalDateTime?
Parameters
text
Value in XML Schema format.
Return Value
Value parsed from XML Schema format (with zone offset), or
nil
iftext
has invalid dateTime format. -
Declaration
Swift
open func plusDays(_ days: Int) -> GlobalDateTime
Parameters
days
Number of days to add. Can be negative, zero or positive.
Return Value
A new dateTime which is the specified number of days ahead of this dateTime.
-
Declaration
Swift
open func plusHours(_ hours: Int64) -> GlobalDateTime
Parameters
hours
Number of hours to add. Can be negative, zero or positive.
Return Value
A new dateTime which is the specified number of hours ahead of this dateTime.
-
Declaration
Swift
open func plusMicros(_ micros: Int64) -> GlobalDateTime
Parameters
micros
Number of microseconds to add. Can be negative, zero or positive.
Return Value
A new dateTime which is the specified number of microseconds ahead of this dateTime.
-
Declaration
Swift
open func plusMillis(_ millis: Int64) -> GlobalDateTime
Parameters
millis
Number of milliseconds to add. Can be negative, zero or positive.
Return Value
A new dateTime which is the specified number of milliseconds ahead of this dateTime.
-
Declaration
Swift
open func plusMinutes(_ minutes: Int64) -> GlobalDateTime
Parameters
minutes
Number of minutes to add. Can be negative, zero or positive.
Return Value
A new dateTime which is the specified number of minutes ahead of this dateTime.
-
Declaration
Swift
open func plusMonths(_ months: Int) -> GlobalDateTime
Parameters
months
Number of months to add. Can be negative, zero or positive.
Return Value
A new dateTime/time which is the specified number of months ahead of this dateTime.
-
Declaration
Swift
open func plusNanos(_ nanos: Int64) -> GlobalDateTime
Parameters
nanos
Number of nanoseconds to add. Can be negative, zero or positive.
Return Value
A new dateTime which is the specified number of nanoseconds ahead of this dateTime.
-
Declaration
Swift
open func plusSeconds(_ seconds: Int64) -> GlobalDateTime
Parameters
seconds
Number of seconds to add. Can be negative, zero or positive.
Return Value
A new dateTime which is the specified number of seconds ahead of this dateTime.
-
Declaration
Swift
open func plusWeeks(_ weeks: Int) -> GlobalDateTime
Parameters
weeks
Number of weeks to add. Can be negative, zero or positive.
Return Value
A new dateTime which is the specified number of weeks ahead of this dateTime.
-
Declaration
Swift
open func plusYears(_ years: Int) -> GlobalDateTime
Parameters
years
Number of years to add. Can be negative, zero or positive.
Return Value
A new dateTime which is the specified number of years ahead of this dateTime.
-
Second field of time (0 to 59).
Declaration
Swift
open var second: Int { get }
-
Local time component of dateTime.
Declaration
Swift
open var time: LocalTime { get }
-
Convert a global date/time to a Julian day number.
Declaration
Swift
open class func toJulian(dt: GlobalDateTime) -> Double
Parameters
dt
Global date/time.
Return Value
Julian day number, with microsecond precision.
-
See also
normalize
.Declaration
Swift
open func toLocal() -> LocalDateTime
Return Value
This local date and time portion of this value, without zone offset.
-
Convert this data value to a string. If the
dataType
is defined by XML Schema Part 2: Datatypes, then the corresponding lexical format is used. JSON format is used for structured values (arrays and objects).Declaration
Swift
override open func toString() -> String
Return Value
Lexical representation of this data value.
-
Year field of date.
Declaration
Swift
open var year: Int { get }
-
Declaration
Swift
open func zone(offset: Int) -> GlobalDateTime
Parameters
offset
Zone offset in minutes (-840 to 840).
Return Value
A dateTime value with all fields the same as the current dateTime value except for the zone offset.