LocalDate
open class LocalDate : DataValue
Represents the XML Schema date type without zone offset.
-
Declaration
Swift
public static func from(utc date: Date, in timeZone: TimeZone = GMT) -> LocalDate
Parameters
utc
UTC-based point in time.
timeZone
Time zone in which the local date will be determined (defaults to GMT). Use
TimeZone.current
for the local time zone.Return Value
Local date equivalent of UTC-based point in time.
-
Compare two date values.
Declaration
Swift
open class func compare(_ left: LocalDate, _ right: LocalDate) -> Int
Parameters
left
The first date for comparison.
right
The second date for comparison.
Return Value
-1 if
left < right
, 0 ifleft == right
, or 1 ifleft > right
. -
Compare this date with another date.
Declaration
Swift
open func compareTo(_ value: LocalDate) -> Int
Parameters
value
The other date value.
Return Value
-1 if this date is less than the value date, 0 if they are equal, 1 if this date is greater than the value date.
-
Declaration
Swift
override open func copyMutable() -> DataValue
Return Value
A clone of this value if it (together with all value subcomponents) is possibly mutable, or return
self
value if it (together with all value subcomponents) is definitely immutable. The resulting value might share mutable metadata with this query. -
Data type of the wrapped value.
Declaration
Swift
override open var dataType: DataType { 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 date values.
Declaration
Swift
open class func equal(_ left: LocalDate?, _ right: LocalDate?) -> Bool
Parameters
left
The first date for comparison.
right
The second date for comparison.
Return Value
true
ifleft
is equal toright
, otherwisefalse
. -
Compare this date value with another date value.
Declaration
Swift
override open func equals(_ other: AnyObject?) -> Bool
Parameters
other
The other date value.
Return Value
True, if this date value is equal to the value date value. Otherwise
false
. -
Compare this date value with another date value.
Declaration
Swift
open func greaterEqual(_ value: LocalDate) -> Bool
Parameters
value
The other date value.
Return Value
true
if this date value is greater than or equal to the value date value. Oherwisefalse
. -
Compare two date values.
Declaration
Swift
open class func greaterEqual(_ left: LocalDate, _ right: LocalDate) -> Bool
Parameters
left
The first date for comparison.
right
The second date for comparison.
Return Value
true
ifleft
is greater than or equal toright
, otherwisefalse
. -
Compare this date value with another date value.
Declaration
Swift
open func greaterThan(_ value: LocalDate) -> Bool
Parameters
value
The other date value.
Return Value
true
if this date value is greater than the value date value. Oherwisefalse
. -
Compare two date values.
Declaration
Swift
open class func greaterThan(_ left: LocalDate, _ right: LocalDate) -> Bool
Parameters
left
The first date for comparison.
right
The second date 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
. -
Compare this date value with another date value.
Declaration
Swift
open func lessEqual(_ value: LocalDate) -> Bool
Parameters
value
The other date value.
Return Value
true
if this date value is less than or equal to the value date value. Oherwisefalse
. -
Compare two date values.
Declaration
Swift
open class func lessEqual(_ left: LocalDate, _ right: LocalDate) -> Bool
Parameters
left
The first date for comparison.
right
The second date for comparison.
Return Value
true
ifleft
is less than or equal toright
, otherwisefalse
. -
Compare this date value with another date value.
Declaration
Swift
open func lessThan(_ value: LocalDate) -> Bool
Parameters
value
The other date value.
Return Value
true
if this date value is less than the value date value. Oherwisefalse
. -
Compare two date values.
Declaration
Swift
open class func lessThan(_ left: LocalDate, _ right: LocalDate) -> Bool
Parameters
left
The first date for comparison.
right
The second date for comparison.
Return Value
true
ifleft
is less thanright
, otherwisefalse
. -
Declaration
Swift
open class func literal(_ text: String) -> LocalDate
Parameters
text
Value in XML Schema format.
Return Value
Value parsed from XML Schema format, or panic if
text
has invalid date format. Useparse
if thetext
is not guaranteed to be in the correct format. -
Declaration
Swift
open func minus(_ value: LocalDate) -> Double
Parameters
value
The other date value.
Return Value
The difference
this - value
, measured in days. -
Month field of date (1 to 12).
See also
MonthOfYear
.Declaration
Swift
open var month: Int { get }
-
Compare this date value with another date value.
Declaration
Swift
open func notEqual(_ value: LocalDate) -> Bool
Parameters
value
The other date value.
Return Value
true
if this date value is not equal to the value date value. Oherwisefalse
. -
Compare two date values.
Declaration
Swift
open class func notEqual(_ left: LocalDate?, _ right: LocalDate?) -> Bool
Parameters
left
The first date for comparison.
right
The second date for comparison.
Return Value
true
ifleft
is not equal toright
, otherwisefalse
. -
Declaration
Swift
open class func now() -> LocalDate
Return Value
The current local date.
-
Declaration
Swift
open class func of(year: Int, month: Int, day: Int) -> LocalDate
Parameters
year
The year field.
month
The month field (1 to 12).
day
The day field (1 to 31).
Return Value
A new date value.
-
Declaration
Swift
open class func parse(_ text: String) -> LocalDate?
Parameters
text
Value in XML Schema format.
Return Value
Value parsed from XML Schema format, or
nil
iftext
has invalid date format. -
Declaration
Swift
open func plusDays(_ days: Int) -> LocalDate
Parameters
days
Number of days to add. Can be negative, zero or positive.
Return Value
A new date which is the specified number of days ahead of this date.
-
Declaration
Swift
open func plusMonths(_ months: Int) -> LocalDate
Parameters
months
Number of months to add. Can be negative, zero or positive.
Return Value
A new date which is the specified number of months ahead of this date.
-
Declaration
Swift
open func plusWeeks(_ weeks: Int) -> LocalDate
Parameters
weeks
Number of weeks to add. Can be negative, zero or positive.
Return Value
A new date which is the specified number of weeks ahead of this date.
-
Declaration
Swift
open func plusYears(_ years: Int) -> LocalDate
Parameters
years
Number of years to add. Can be negative, zero or positive.
Return Value
A new date which is the specified number of years ahead of this date.
-
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 }