LocalDateTime

open class LocalDateTime: DataValue

Represents the XML Schema dateTime type without zone offset.

  • Note

    Some backend systems provide LocalDateTime values containing local date/time as it would appear in GMT, whereas other backend systems provide LocalDateTime values containing local date/time in an unspecified local time zone. Knowledge of the date/time conventions of the intended backend systems is important for correct conversion.

    Declaration

    Swift

    public func utc(from timeZone: TimeZone = GMT) -> Date

    Parameters

    timeZone

    Time zone from which the local date/time will be converted (defaults to GMT). Use TimeZone.current for the local time zone.

    Return Value

    This local date/time value converted to UTC-based point in time.

  • Note

    Some backend systems expect LocalDateTime values containing local date/time as it would appear in GMT, whereas other backend systems expect LocalDateTime values containing local date/time in an unspecified local time zone. Knowledge of the date/time conventions of the intended backend systems is important for correct conversion.

    Declaration

    Swift

    public static func from(utc dateTime: Date, in timeZone: TimeZone = GMT) -> LocalDateTime

    Parameters

    utc

    UTC-based point in time.

    timeZone

    Time zone in which the local date/time will be determined (defaults to GMT). Use TimeZone.current for the local time zone.

    Return Value

    Local date/time equivalent of UTC-based point in time.

  • Compare two dateTime values.

    Declaration

    Swift

    open class func compare(_ left: LocalDateTime, _ right: LocalDateTime) -> Int

    Parameters

    left

    The first dateTime for comparison.

    right

    The second dateTime for comparison.

    Return Value

    -1 if left < right, 0 if left == right, or 1 if left > right.

  • Compare this dateTime with another dateTime.

    Declaration

    Swift

    open func compareTo(_ value: LocalDateTime) -> Int

    Parameters

    value

    The other dateTime.

    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
  • Local date component of dateTime.

    Declaration

    Swift

    open var date: LocalDate
  • day

    Day field of date (1 to 31).

    Declaration

    Swift

    open var day: Int
  • Day of week (1 to 7).

    See also

    DayOfWeek.

    Declaration

    Swift

    open var dayOfWeek: Int
  • Day of year (1 to 366).

    Declaration

    Swift

    open var dayOfYear: Int
  • Compare two dateTime values.

    Declaration

    Swift

    open class func equal(_ left: LocalDateTime?, _ right: LocalDateTime?) -> Bool

    Parameters

    left

    The first dateTime for comparison.

    right

    The second dateTime for comparison.

    Return Value

    true if left is equal to right, otherwise false.

  • Compare this dateTime value with another dateTime value.

    Declaration

    Swift

    override open func equals(_ value: AnyObject?) -> Bool

    Parameters

    value

    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: LocalDateTime) -> Bool

    Parameters

    value

    The other dateTime value.

    Return Value

    true if this dateTime value is greater than or equal to the value dateTime value. Oherwise false.

  • Compare two dateTime values.

    Declaration

    Swift

    open class func greaterEqual(_ left: LocalDateTime, _ right: LocalDateTime) -> Bool

    Parameters

    left

    The first dateTime for comparison.

    right

    The second dateTime for comparison.

    Return Value

    true if left is greater than or equal to right, otherwise false.

  • Compare this dateTime value with another dateTime value.

    Declaration

    Swift

    open func greaterThan(_ value: LocalDateTime) -> Bool

    Parameters

    value

    The other dateTime value.

    Return Value

    true if this dateTime value is greater than the value dateTime value. Oherwise false.

  • Compare two dateTime values.

    Declaration

    Swift

    open class func greaterThan(_ left: LocalDateTime, _ right: LocalDateTime) -> Bool

    Parameters

    left

    The first dateTime for comparison.

    right

    The second dateTime for comparison.

    Return Value

    true if left is greater than right, otherwise false.

  • 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
  • Compare this dateTime value with another dateTime value.

    Declaration

    Swift

    open func lessEqual(_ value: LocalDateTime) -> Bool

    Parameters

    value

    The other dateTime value.

    Return Value

    true if this dateTime value is less than or equal to the value dateTime value. Oherwise false.

  • Compare two dateTime values.

    Declaration

    Swift

    open class func lessEqual(_ left: LocalDateTime, _ right: LocalDateTime) -> Bool

    Parameters

    left

    The first dateTime for comparison.

    right

    The second dateTime for comparison.

    Return Value

    true if left is less than or equal to right, otherwise false.

  • Compare this dateTime value with another dateTime value.

    Declaration

    Swift

    open func lessThan(_ value: LocalDateTime) -> Bool

    Parameters

    value

    The other dateTime value.

    Return Value

    true if this dateTime value is less than the value dateTime value. Oherwise false.

  • Compare two dateTime values.

    Declaration

    Swift

    open class func lessThan(_ left: LocalDateTime, _ right: LocalDateTime) -> Bool

    Parameters

    left

    The first dateTime for comparison.

    right

    The second dateTime for comparison.

    Return Value

    true if left is less than right, otherwise false.

  • Declaration

    Swift

    open class func millisBetween(a: LocalDateTime, b: LocalDateTime) -> Int64

    Parameters

    a

    The first dateTime value.

    b

    The second dateTime value.

    Return Value

    The difference in milliseconds between two dateTime values a and b, calculated as b - a.

  • Declaration

    Swift

    open func minus(_ value: LocalDateTime) -> Double

    Parameters

    value

    The other dateTime.

    Return Value

    The difference this - value, measured in days.

  • Minute field of time (0 to 59).

    Declaration

    Swift

    open var minute: Int
  • Month field of date (1 to 12).

    See also

    MonthOfYear.

    Declaration

    Swift

    open var month: Int
  • Nanosecond field of time (0 to 999999999).

    Declaration

    Swift

    open var nano: Int
  • Compare this dateTime value with another dateTime value.

    Declaration

    Swift

    open func notEqual(_ value: LocalDateTime) -> Bool

    Parameters

    value

    The other dateTime value.

    Return Value

    true if this dateTime value is not equal to the value dateTime value. Oherwise false.

  • Compare two dateTime values.

    Declaration

    Swift

    open class func notEqual(_ left: LocalDateTime?, _ right: LocalDateTime?) -> Bool

    Parameters

    left

    The first dateTime for comparison.

    right

    The second dateTime for comparison.

    Return Value

    true if left is not equal to right, otherwise false.

  • Declaration

    Swift

    open class func now() -> LocalDateTime

    Return Value

    The current local dateTime.

  • Declaration

    Swift

    open class func of(year: Int, month: Int, day: Int, hour: Int, minute: Int, second: Int, nano: Int = (0 as Int)) -> LocalDateTime

    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.

  • Declaration

    Swift

    open class func parse(_ text: String) -> LocalDateTime?

    Parameters

    text

    Value in XML Schema format.

    Return Value

    Value parsed from XML Schema format, or nil if text has invalid dateTime format.

  • Declaration

    Swift

    open func plusDays(_ days: Int) -> LocalDateTime

    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) -> LocalDateTime

    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) -> LocalDateTime

    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) -> LocalDateTime

    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) -> LocalDateTime

    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) -> LocalDateTime

    Parameters

    months

    Number of months to add. Can be negative, zero or positive.

    Return Value

    A new dateTime which is the specified number of months ahead of this dateTime.

  • Declaration

    Swift

    open func plusNanos(_ nanos: Int64) -> LocalDateTime

    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) -> LocalDateTime

    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) -> LocalDateTime

    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 dat/timee.

  • Declaration

    Swift

    open func plusYears(_ years: Int) -> LocalDateTime

    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
  • Local time component of dateTime.

    Declaration

    Swift

    open var time: LocalTime
  • See also

    GlobalDateTime.normalize.

    Declaration

    Swift

    open func toGlobal(offset: Int = (0 as Int)) -> GlobalDateTime

    Parameters

    offset

    Zone offset in minutes.

    Return Value

    This value converted to a global date and time, with specified 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