Skip to main content
IlConte
Associate II
September 5, 2023
Solved

RTC 30 Feb

  • September 5, 2023
  • 4 replies
  • 1448 views

Hello st community, I work on stm32F4, and I use with RTC for date time.

When I write in RTC a wrong day (for example 30 Feb 2023 or 31 Apr 2023) I havent a error in the result.

It is possible to ask if the data is correct ?

if (HAL_RTC_SetDate(&hrtc, &sDate_present_tmp, RTC_FORMAT_BIN) == HAL_OK)

This topic has been closed for replies.
Best answer by Tesla DeLorean

Pretty sure it's not responsible for range checking your input. That's really going to fall on to code you have to check user input, for things like leap years, and days in the month, etc.

4 replies

Issamos
Super User
September 5, 2023

Hello @IlConte 

Since you have the ability to programme the date ( the exact date) then is  impossible to verify if the RTC date is true or not.

Best regards.

II

ST Employee
September 5, 2023

Hello @IlConte

Could you share a code snippet of RTC configuration

Also, which clock source are you using? 

 

To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.
Tesla DeLorean
Tesla DeLoreanBest answer
Guru
September 5, 2023

Pretty sure it's not responsible for range checking your input. That's really going to fall on to code you have to check user input, for things like leap years, and days in the month, etc.

Tips, Buy me a coffee, or three.. PayPal Venmo (See Profile) Up vote any posts that you find helpful, it shows what's working..
IlConte
IlConteAuthor
Associate II
September 6, 2023

Thanks I add checkin month / date in the input