05-20-2009 04:54 AM
Hi to all labview'ers
I'm working on a time stamper that can write data file with some data including its Time stamp.
The data file must be readable in EXCEL too.
Excel use its own Time Base, wich is since 01-01-1900 00:00:00, and reads a time stamp as days. as the Proffesional 'GerdW' mentioned in a earlier link.
So when i use my timespan calculator to calculate back to 01-01-1900 00:00:00 from 01-01-1904 00:00:00 and calculate the time span to days, so to be Readable in Excel, i get nearly 2 hours of wrong time span.
Is some how my calculations wrong when i calculate that the time from 01-01-1900 00:00:00 - 01-01-1904 00:00:00 is about 126316800 seconds ??
HFZ - Electronic Engineering- Labview 7.1
05-20-2009 05:10 AM
HFZ wrote:Excel use its own Time Base, wich is since 01-01-1900 00:00:00, and reads a time stamp as days. as the Proffesional 'GerdW' mentioned in a earlier link.
That is here
05-20-2009 05:31 AM - edited 05-20-2009 05:33 AM
05-20-2009 06:46 AM
Hi Thoric.
You possible right about that. Coz i calculated two 'Leap years' on these 4 years . But i can see that Labview also calculates wrong,as your calculations shows.
from 01-01-1900 00:00:00 to 01-01-1904 00:00:00, there is one leap year. that means (366+365+365+365) = 1461 days = 126230400 sec.
So labview does certainly not calculate with Leap Years!!??
HFZ.
05-20-2009 06:58 AM
There are NO leap days between 01/01/1900 and 01/01/1904
The century years are only leap years if the hundreds are divisible by 4. So 1900 was not a leap year. but 2000 was.
Therefore there are 60 * 60 * 24 * 365 * 4 = 126144000 seconds between the two times mentioned.
05-20-2009 07:15 AM - edited 05-20-2009 07:21 AM
LabVIEW certainly does consider leap years, but I agree that the first leap year appears to have been missed in the calculation. A little checking seems to indicate that leap years before 1904 are not correctly determined, and therefore not taken into account. This probably relates to the fact that LabVIEW uses 01.01.1904 as it's baseline.
If you take this leap day into account, then the number of days increases by one, and the time difference increases to 126230400 seconds, which is 86,400 seconds from your original value 126316800 seconds. A difference of just one day. Still not quite the "approximately 2 hours" you are seeing.
But 1900 is not a leap year. See my other post in this thread.
05-20-2009 07:20 AM
Checking wiki has shed some light on this.
Divisible by four is not the whole rule. When the year is divisible by 100, it is not considered a leap year, unless it is also divisible by 400, in which case it is. This is to account for the fact that the solar year is not quite exactly 365.25 days, but 365.2425 days.
So it seems LabVIEW got it right again! 1900 is not a leap year.
05-20-2009 07:46 AM
Hi,
Please try "126164000" instead of "126144000 " in SecToDaysConv3.vi
05-20-2009 09:29 AM
That is the count of seconds since 01-01-1904 00:00:00 until almost 20-05-2009 16:18:00 (almost !!) SECONDS: 3325673340,10500002 . In labview.
so to calculate so it can be Red in EXCEL i must add 4 years of seconds to this number that is.
if Sreeprath... are right ! 126164000 + 3325673340,10500002 = 3451837340,10500002 seconds . Gives 39951,821066030092824074074074074 days.
That gives a day in Excel a date 18-05-2009 19:42:20. that is almost 2,25 days wrong!
How is it right then??
I found a calculation method from a microsoft link.... i'll try it and then be back with info.!
HFZ
05-20-2009 10:22 AM
LabVIEW may or may not have it correct that 1900 was not a leap year, but MS Excel definitely has it wrong and thinks that 2/29/1900 was a leap day.
So the difference between 1/1/1900 and 1/1/1904 is 4*365 +1 or 1461 days or 126,230,400 seconds.
Also remember that the time zone comes into effect when working with date stamps. For me being in the eastern time zone, 0 seconds is 7:00:00 pm on 12/31/1903 GMT -5 hours.