Enumeration

enum DayOfWeek

public enum DayOfWeek <: ToString {
    | Sunday
    | Monday
    | Tuesday
    | Wednesday
    | Thursday
    | Friday
    | Saturday
}

Description: Indicates a day of a week. It provides functionality of Int64 type conversion, equality judgment, and obtaining the string representation of enumerated values.

Parent Type:

Friday

Friday

Description: Constructs a DayOfWeek instance indicating Friday.

Monday

Monday

Description: Constructs a DayOfWeek instance indicating Monday.

Saturday

Saturday

Description: Constructs a DayOfWeek instance indicating Saturday.

Sunday

Sunday

Description: Constructs a DayOfWeek instance indicating Sunday.

Thursday

Thursday

Description: Constructs a DayOfWeek instance indicating Thursday.

Tuesday

Tuesday

Description: Constructs a DayOfWeek instance indicating Tuesday.

Wednesday

Wednesday

Description: Constructs a DayOfWeek instance indicating Wednesday.

static func of(Int64)

public static func of(dayOfWeek: Int64): DayOfWeek

Description: Obtains the DayOfWeek instance corresponding to the parameter dayOfWeek.

Parameters:

  • dayOfWeek: Int64: integer representation of a day of a week. The valid range is [0, 6]. 0 indicates Sunday, and 1 to 6 indicate Monday to Saturday respectively.

Returns:

Throws:

func toString()

public func toString(): String

Description: Returns the string representation of the current DayOfWeek instance. For example, "Monday" indicates Monday.

Returns:

func value()

public func value(): Int64

Description: Obtains the integer representation of the current DayOfWeek instance. Sunday is represented by 0, and Monday to Saturday are represented by 1 to 6 respectively.

Returns:

operator func !=(DayOfWeek)

public operator func !=(r: DayOfWeek): Bool

Description: Checks whether the current DayOfWeek and r indicate different days of a week.

Parameters:

Returns:

  • Bool: true or false . If the current DayOfWeek instance is not equal to r, true is returned; otherwise, false is returned.

operator func ==(DayOfWeek)

public operator func ==(r: DayOfWeek): Bool

Description: Checks whether the current DayOfWeek and r indicate the same day of a week.

Parameters:

Returns:

  • Bool: true or false . If the current DayOfWeek instance is equal to r, true is returned; otherwise, false is returned.

enum Month

public enum Month <: ToString {
    | January
    | February
    | March
    | April
    | May
    | June
    | July
    | August
    | September
    | October
    | November
    | December
}

Description: Indicates a month, that is, a month in a year. It provides functionality of Int64 type conversion and calculation, equality judgment, and obtaining the string representation of enumerated values.

Parent Type:

April

April

Description: Constructs a Month instance indicating April.

August

August

Description: Constructs a Month instance indicating August.

December

December

Description: Constructs a Month instance indicating December.

February

February

Description: Constructs a Month instance indicating February.

January

January

Description: Constructs a Month instance indicating January.

July

July

Description: Constructs a Month instance indicating July.

June

June

Description: Constructs a Month instance indicating June.

March

March

Description: Constructs a Month instance indicating March.

May

May

Description: Constructs a Month instance indicating May.

November

November

Description: Constructs a Month instance indicating November.

October

October

Description: Constructs a Month instance indicating October.

September

September

Description: Constructs a Month instance indicating September.

static func of(Int64)

public static func of(mon: Int64): Month

Description: Obtains the Month instance corresponding to the parameter mon.

Parameters:

  • mon: Int64: integer representation of a month. The valid range is [1, 12], indicating the 12 months in a year.

Returns:

  • Month: Month instance corresponding to the parameter mon

Throws:

func toString()

public func toString(): String

Description: Returns the string representation of the current Month instance. For example, "January" indicates January.

Returns:

  • String: string representation of the current Month instance

func value()

public func value(): Int64

Description: Obtains the integer representation of the current Month instance. January to December are represented by 1 to 12 respectively.

Returns:

  • Int64: integer representation of the current Month instance

operator func !=(Month)

public operator func !=(r: Month): Bool

Description: Checks whether the current Month instance and r indicate different months.

Parameters:

Returns:

  • Bool: Whether the current Month instance is not equal to r.

operator func +(Int64)

public operator func +(n: Int64): Month

Description: Calculates the calendar month that is n months later than the current calendar month (n is a positive number). If n is a negative number, it indicates a month earlier than the current month.

Parameters:

  • n: Int64: number of months

Returns:

  • Month: month that is n months later

operator func -(Int64)

public operator func -(n: Int64): Month

Description: Calculates the calendar month that is n months earlier than the current calendar month (n is a positive number). If n is a negative number, it indicates a month later than the current month.

Parameters:

  • n: Int64: number of months

Returns:

  • Month: month that is n months earlier

operator func ==(Month)

public operator func ==(r: Month): Bool

Description: Checks whether the current Month instance and r indicate the same month.

Parameters:

Returns:

  • Bool: true or false. If the current Month instance is equal to r, true is returned; otherwise, false is returned.