createDate

fun createDate(year: Int, month: Int, day: Int, hours: Int = 0, minutes: Int = 0, seconds: Int = 0): Date

Helper method used to create a new Date object. The resulting date is in UTC.

All parameters are validated for range before the date is constructed. The day parameter is validated against the actual maximum for the given month and year, accounting for leap years.

Parameters

year

integer representing the year. Must be positive.

month

integer representing the month. The month is 0-based (0 for January, 11 for December).

day

integer representing the day of the month. Must be between 1 and the maximum day for the given month/year.

hours

integer representing the hour of the day (0-23).

minutes

integer representing the minutes of the hour (0-59).

seconds

integer representing the seconds of the minute (0-59).

Throws

if any parameter is out of its valid range.


Helper method used to convert seconds from epoch to a new Date object. The resulting date is in UTC.