NTPClient
NTPClient copied to clipboard
how to retrieve dayOfWeek, day, month, year?
how to retrieve dayOfWeek, day, month, year? (either using Unix time string or via extra functions, feat time zone offsets) an example sketch shipping with this lib would be highly appreciated!
This for Day, Month and Year: https://randomnerdtutorials.com/esp32-ntp-client-date-time-arduino-ide/ And for Day of the Week you could use some kind of counter function, containing all Weekdays(Monday, Tuesday, Wednesday, Thursday, Friday, Saturday, Sunday) and starting from a known Date with Weekday with counting...
Edit: Looks like someone made the Fix for this code here(didnt tried it myself): https://github.com/gmag11/NtpClient/issues/84
tbh, the split function of formatted date is quite complicated in order to get dayOfWeek, day, month, year in exactly that order additionally to time (hours, minutes, seconds, perhaps millisec) It would be easier to get them by dedicated direct-call functions like
int formattedDate.hoursint formattedDate.minutesint formattedDate.secondsint formattedDate.millisecchar* formattedDate.dayOfWeekorString formattedDate.dayOfWeekint formattedDate.dayint formattedDate.monthint formattedDate.year
@dsyleixa dedicated direct-call functions are available Please refer that.
@dsyleixa dedicated direct-call functions are available Please refer that.
what do you want to express? what is available? where is the documentation about all and everything? where are all the related code examples?
I'd also like to get day/month/year functions, as that would allow to implement daylight saving properly (as that actually follows quite simple rules in most places). Also for other use cases these might be convenient.
PS: #94 would address this topic, for example.