getDaysInMonth
Get the number of days in the given month and year
Function parameters
Parameters
Type definitions in this namespace
Types
- EpochDay
- days since epoch Jan 1, 1970
- DaySeconds
- seconds since start of day
- EpochSeconds
- seconds since epoch Jan 1, 1970 at 12:00 AM
Functions in this namespace
Functions
- getDaysInMonth
- Get the number of days in the given month and year
Jan 01, 1970 AD
Values
- posix
- Jan 01, 1970 AD
- dos
- Jan 01, 1980 AD
- ios
- Jan 01, 2001 AD
- openvms
- Nov 17, 1858 AD
- zos
- Jan 01, 1900 AD
- windows
- Jan 01, 1601 AD
- amiga
- Jan 01, 1978 AD
- pickos
- Dec 31, 1967 AD
- gps
- Jan 06, 1980 AD
- clr
- Jan 01, 0001 AD
- unix
- = posix
- android
- = posix
- os2
- = dos
- bios
- = dos
- vfat
- = dos
- ntfs
- = windows
- ntp
- = zos
- jbase
- = pickos
- aros
- = amiga
- morphos
- = amiga
- brew
- = gps
- atsc
- = gps
- go
- = clr
- epoch_year
- = 1970
- secs_per_day
- = 24 * 60 * 60
Source
Implementation
pub fn getDaysInMonth(year: Year, month: Month) u5 {
return switch (month) {
.jan => 31,
.feb => @as(u5, switch (isLeapYear(year)) {
true => 29,
false => 28,
}),
.mar => 31,
.apr => 30,
.may => 31,
.jun => 30,
.jul => 31,
.aug => 31,
.sep => 30,
.oct => 31,
.nov => 30,
.dec => 31,
};
}