So i am getting my time from an api that returns epoch time and i need to pass that time into a Real Time Clock function which accepts this dateTime structure
datetime_t t = { // Friday June 5, Hour 15, Minute 45, Sec 00
.year = 2020,
.month = 06,
.day = 05,
.dotw = 5, // 0 is Sunday, so 5 is Friday
.hour = 15,
.min = 45,
.sec = 00
};
I need help creating a formula to get those individual values. I think i have made a formula for the easy ones.
sec = epochTime%60
min = floor((epochTime%3600)/60)
hour = floor((epochTime%86400)/3600)
as for the others it is not that easy anymore as there are leap years and such. i have to do this with only standard libraries or you can suggest a web api that returns me those value (it has to be only 1 api for all of those data)