cancel
Showing results for 
Search instead for 
Did you mean: 

RTC 30 Feb

IlConte
Associate III

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)

1 ACCEPTED SOLUTION

Accepted Solutions

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
Up vote any posts that you find helpful, it shows what's working..

View solution in original post

4 REPLIES 4
Issamos
Lead II

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

Sarra.S
ST Employee

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.

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
Up vote any posts that you find helpful, it shows what's working..

Thanks I add checkin month / date in the input