SdFat
|
Date utility functions. More...
Macros | |
#define | EPOCH_YEAR 2000 |
#define | USE_FULL_LEAP 1 |
Functions | |
uint8_t | dayOfWeek (uint16_t Y, uint8_t M, uint8_t D) |
uint16_t | dayOfYear (uint16_t Y, uint8_t M, uint8_t D) |
uint8_t | dayOfYearToDay (uint16_t doy, uint16_t Y, uint8_t M) |
uint8_t | dayOfYearToMonth (uint16_t doy, uint16_t Y) |
uint16_t | daysBeforeMonth (uint16_t Y, uint8_t M) |
uint16_t | daysSinceEpoch (uint16_t Y, uint8_t M, uint8_t D) |
uint8_t | epochDayToDayOfWeek (uint16_t eday) |
uint16_t | epochDayToYear (uint16_t eday) |
void | epochDayToYMD (uint16_t eday, uint16_t *Y, uint8_t *M, uint8_t *D) |
bool | leap (uint16_t Y) |
uint8_t | monthLength (uint16_t Y, uint8_t M) |
Date utility functions.
Copyright (c) 2011-2020 Bill Greiman This file is part of the SdFat library for SD memory cards.
MIT License
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#define EPOCH_YEAR 2000 |
EPOCH starts on Jan 1 of EPOCH_YEAR.
#define USE_FULL_LEAP 1 |
Set USE_FULL_LEAP zero if 1900 < year and year < 2100.
|
inline |
Day of week with Sunday == 0.
[in] | Y | year |
[in] | M | month 1 <= M <= 12 |
[in] | D | day 1 <= D <= (last day of month) |
|
inline |
Day of year with Jan1 == 0.
[in] | Y | year in range supported by leap(). |
[in] | M | month 0 < M < 13 |
[in] | D | day 0 < D <= length of month |
uint8_t dayOfYearToDay | ( | uint16_t | doy, |
uint16_t | Y, | ||
uint8_t | M | ||
) |
Day of year to month
[in] | doy | day of year 0 <= yday <= 365 |
[in] | Y | year |
[in] | M | month 1 <= M <= 12 |
uint8_t dayOfYearToMonth | ( | uint16_t | doy, |
uint16_t | Y | ||
) |
Day of year to month
[in] | doy | day of year 0 <= yday <= 365 |
[in] | Y | year |
|
inline |
Number of days in the year before the current month
[in] | Y | year |
[in] | M | month 0 < M < 13 |
|
inline |
Count of days since Epoch. 1900 < EPOCH_YEAR, MAX_YEAR < 2100, (MAX_YEAR - EPOCH_YEAR) < 178.
[in] | Y | year (EPOCH_YEAR <= Y <= MAX_YEAR) |
[in] | M | month 1 <= M <= 12 |
[in] | D | day 1 <= D <= 31 |
Derived from Zeller's congruence
|
inline |
epoch day to day of week (Sunday == 0) 1900 < EPOCH_YEAR, MAX_YEAR < 2100, (MAX_YEAR - EPOCH_YEAR) < 178.
[in] | eday | count of days since epoch. |
|
inline |
Day of epoch to year 1900 < EPOCH_YEAR, MAX_YEAR < 2100, (MAX_YEAR - EPOCH_YEAR) < 178.
[in] | eday | count of days since epoch |
|
inline |
epoch day to year, month, day 1900 < EPOCH_YEAR, MAX_YEAR < 2100, (MAX_YEAR - EPOCH_YEAR) < 178. Based on "Software, Practice and Experience", Vol. 23 (1993) page 384.
[in] | eday | count of days since epoch |
[out] | Y | year |
[out] | M | month |
[out] | D | day |
|
inline |
Determine leap year.
[in] | Y | year |
|
inline |
Number of days in a month.
[in] | Y | year |
[in] | M | month 0 < M < 13 |