SDL_GetDayOfYear(3)
π SDL_GetDayOfYear π
okay so bestie, we're in the SDL3 FUNCTIONS section of the manual and this one is literally so useful β it's the lil function that tells you which day of the year a calendar date lands on. yes, the "wait, is March 3rd day 62 or day 63??" question, answered. no cap. β¨
πΈ NAME πΈ
SDL_GetDayOfYear β get the day of year for a calendar date. that's it, that's the whole vibe ποΈπ
π¦ SYNOPSIS π¦
#include <SDL3/SDL_time.h>
int SDL_GetDayOfYear(int year, int month, int day);
π FUNCTION PARAMETERS π
three lil inputs, all of them your responsibility to get right, okay? π«Ά
yearβ the year component of the date. the big number. the "20xx" part. πmonthβ the month component of the date. yes you have to actually pick one, it won't guess. πdayβ the day component of the date. the day-of-the-month day. not the day-of-year day. that's literally what we're computing. stay with me bestie π
β RETURN VALUE β
so here's the tea:
- if the date is valid, you get the day of year back, and it's in the range
[0-365]π - if it's not valid, you get
-1π and that's your signal to callSDL_GetError()for more information.
fr fr, always check for that-1. it's giving "something went wrong" and you do NOT want to be out here treating-1like a real day of the year. π
π§ THREAD SAFETY π§
it is safe to call this function from any thread. go off, multithreaded queen. πβ¨
π AVAILABILITY π
this function is available since SDL 3.2.0. so if you're on something older... bestie. update. π
π ok that's the whole page!! written by Simple Directmedia Layer for SDL 3.4.18 β mwah, slay, go compute some days of the year, ily, bye!! ππ¦π
π¦ where this page comes from
- fedora 43: SDL3-devel 3.4.18-1.fc43 Β· Zlib AND MIT AND Apache-2.0 AND (Apache-2.0 OR MIT)
- fedora 43: SDL3-devel 3.4.18-1.fc43 Β· Zlib AND MIT AND Apache-2.0 AND (Apache-2.0 OR MIT)
- fedora 44: SDL3-devel 3.4.18-1.fc44 Β· Zlib AND MIT AND Apache-2.0 AND (Apache-2.0 OR MIT)
- fedora 44: SDL3-devel 3.4.18-1.fc44 Β· Zlib AND MIT AND Apache-2.0 AND (Apache-2.0 OR MIT)
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms