Loading...
Searching...
No Matches
date.h File Reference

Pure calendar math you can test off the watch. Week numbers, day counts, and month shapes worked out from plain numbers, so it needs no Pebble services and no struct tm. More...

Go to the source code of this file.

Functions

int date_iso_week (int year, int yday, int wday)
 The ISO 8601 week number, which always counts weeks from Monday.
int date_iso_week_year (int year, int yday, int wday)
 The ISO 8601 year the week number belongs to, which is not always the calendar year.
int date_iso_weeks_in_year (int year)
 How many ISO 8601 weeks a year holds, either 52 or 53.
int date_day_of_year (int yday)
 Which day of the year it is, counting January 1st as day 1.
int date_days_left_in_year (int year, int yday)
 How many days are left before the year ends, so December 31st reads 0.
int date_days_in_month (int year, int mon0)
 How many days a month has, with February getting its leap day.
int date_first_wday (int wday, int mday)
 The weekday the 1st of the month lands on, walked back from today's weekday.

Detailed Description

Pure calendar math you can test off the watch. Week numbers, day counts, and month shapes worked out from plain numbers, so it needs no Pebble services and no struct tm.

The inputs are the same fields a struct tm carries, handed in one at a time so this stays pure core code. Year is the full year (2026). Month is 0 January to 11 December. Weekday is 0 Sunday to 6 Saturday. Day of the year (yday) counts January 1st as 0, like tm_yday.