abla/date

Generated from source.

Import with import "abla/date".

Source: abla/date/entry.ab

UtcDate (class)

class UtcDate(
    val year: int,
    // 1 (January) to 12.
    val month: int,
    // 1 to 31.
    val day: int,
    val hour: int,
    val minute: int,
    val second: int,
    val millisecond: int,
    // 0 (Sunday) to 6 (Saturday).
    val weekday: int
)

A UTC date and time in the proleptic Gregorian calendar. Fields are stored as supplied, without validation. Use utcDate to compute consistent fields from a timestamp.

dateLeapYear (fun)

fun dateLeapYear(year: int): bool

Returns true if year is a Gregorian leap year.

dateDaysInMonth (fun)

fun dateDaysInMonth(year: int, month: int): int

Returns the number of days in month for year, accounting for leap years in February. Out-of-range month numbers return 31.

utcDate (fun)

fun utcDate(milliseconds: int): UtcDate

The civil date and time of milliseconds since 1970-01-01T00:00:00Z (Howard Hinnant's civil_from_days).

utcMilliseconds (fun)

fun utcMilliseconds(
    year: int,
    month: int,
    day: int,
    hour: int = 0,
    minute: int = 0,
    second: int = 0,
    millisecond: int = 0
): int

Milliseconds since 1970-01-01T00:00:00Z of a civil date and time.

UtcDate.milliseconds (extension fun)

fun UtcDate.milliseconds(): int

Returns Unix milliseconds computed from the date and time fields. The stored weekday is ignored and fields are not validated.

UtcDate.dayOfYear (extension fun)

fun UtcDate.dayOfYear(): int

1 (January 1st) to 366.

UtcDate.isoDate (extension fun)

fun UtcDate.isoDate(): string

"2026-10-06"

UtcDate.isoTime (extension fun)

fun UtcDate.isoTime(): string

"08:30:05"

UtcDate.iso8601 (extension fun)

fun UtcDate.iso8601(): string

"2026-10-06T08:30:05.250Z"

utcIso8601 (fun)

fun utcIso8601(milliseconds: int): string

Formats Unix milliseconds as UTC ISO 8601 text, with three fractional digits and a trailing Z.

dateWeekdayName (fun)

fun dateWeekdayName(weekday: int): string

Returns the English abbreviation for weekday, numbered 0 for Sunday through 6 for Saturday. Unrecognized values return Sat.

dateMonthName (fun)

fun dateMonthName(month: int): string

Returns the English abbreviation for month, numbered 1 for January through 12 for December. Unrecognized values return Dec.

UtcDate.httpDate (extension fun)

fun UtcDate.httpDate(): string

The HTTP date (RFC 9110 IMF-fixdate): "Tue, 06 Oct 2026 08:30:05 GMT".

httpDate (fun)

fun httpDate(milliseconds: int): string

Formats Unix milliseconds as an HTTP date in GMT, discarding subsecond precision.

utcIso8601Parse (fun)

fun utcIso8601Parse(text: string): int?

The time of "2026-10-06", "2026-10-06T08:30:05Z" or "2026-10-06T08:30:05.250Z", or null for any other text. A year outside 0000 to 9999 is written with a sign and six digits, as iso8601() writes it ("-000001-12-31T23:59:59.999Z", "+010000-01-01T00:00:00.000Z"); "-000000" is not a year.

httpDateParse (fun)

fun httpDateParse(text: string): int?

The time of an HTTP date ("Tue, 06 Oct 2026 08:30:05 GMT"), or null.

Built from Abla v0.2.79 source ba5d6b7d. Examples and generated signatures follow that source revision.