Hello everyone,
I need to get the current hour, min and sec using RTC. I am using stm32f767ZI. I used the example code for RTC and I am able to see the current time.
Can anyone tell me how to get the hours, min and sec separately.
time_t seconds = time(NULL);
printf(“Time as a basic string = %s\n”, ctime(&seconds));
strftime(buffer, 32, “%H:%M:%S %p\n”, localtime(&seconds));
printf(“Time as a custom formatted string = %s”, buffer);
This code prints out the time but I am not clear how to get the hours, mins and sec as integers separately. Thanks.