Hi!
I'm trying to find the most accurate way of calculating todays date, based on the number of days elapsed since January first 1984.
Apparently this is a "normal" way of displaying the date in CPUs, but I have not been able to find anything about it (google has not been my friend in this).
All I get is links to calculators or how to use a function in Excel.
I'm using a Siemens S7-1200 CPU at the moment, but we will be using this in a multitude of PLC brands.
When I read the days counter I get 8401 days since 1984-01-01 (the date in my drive is 2007-01-01). 8401/365 = 23,01643835..... 1984 + 23 = 2007 - but I'm concerned about leap years and february medling with my numbers.
I'm sure i have seen this calculation somewhere before, but i can't remember where :-(
I'm trying to find the most accurate way of calculating todays date, based on the number of days elapsed since January first 1984.
Apparently this is a "normal" way of displaying the date in CPUs, but I have not been able to find anything about it (google has not been my friend in this).
All I get is links to calculators or how to use a function in Excel.
I'm using a Siemens S7-1200 CPU at the moment, but we will be using this in a multitude of PLC brands.
When I read the days counter I get 8401 days since 1984-01-01 (the date in my drive is 2007-01-01). 8401/365 = 23,01643835..... 1984 + 23 = 2007 - but I'm concerned about leap years and february medling with my numbers.
I'm sure i have seen this calculation somewhere before, but i can't remember where :-(