Hi there,
A noob question...
I got a date and time by parsing chars and I thought that checking theirs validity would be a nice QA for the parsing routine.
Could not find a function in the library to validate tmElements_t.
I actually found that setTime(makeTime(TME));
will accept "36 Jun 2018 15:28:43" and will convert it to "6 Jul 2018 15:28:43"
And that was the base to a function I wrote
boolean validateDate(tmElements_t &TME) {
tmElements_t TMValidate;
time_t timeT;
timeT = makeTime(TME);
breakTime(timeT, TMValidate);
return TME.Year == TMValidate.Year && TME.Month == TMValidate.Month && TME.Day == TMValidate.Day && TME.Hour == TMValidate.Hour && TME.Minute == TMValidate.Minute && TME.Second == TMValidate.Second;
}
It Seems to work... Any better way?
Thanks