LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Can't get Right Real time when calculate from back to, 01-01-1900 00: 00: 00.

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

HFZ
0 Kudos
Message 1 of 21
(4,617 Views)

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

Message 2 of 21
(4,610 Views)

According to LabVIEW, the time difference from 01-01-1900 to 01-01-1904 is 126144000 seconds. Not 126616800 seconds. I calculate that you are 172800 seconds out, which is 2 days, not 2 hours.

 

 

Message Edited by Thoric on 05-20-2009 11:33 AM
Thoric (CLA, CLED, CTD and LabVIEW Champion)


0 Kudos
Message 3 of 21
(4,602 Views)

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.

HFZ
0 Kudos
Message 4 of 21
(4,585 Views)

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.

 

 

Message 5 of 21
(4,580 Views)

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.

Message Edited by Thoric on 05-20-2009 01:21 PM
Thoric (CLA, CLED, CTD and LabVIEW Champion)


0 Kudos
Message 6 of 21
(4,573 Views)

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.

 

Thoric (CLA, CLED, CTD and LabVIEW Champion)


0 Kudos
Message 7 of 21
(4,571 Views)

Hi,

 

Please try "126164000" instead of "126144000 " in SecToDaysConv3.vi

Into the pursuit...
Maverick
0 Kudos
Message 8 of 21
(4,566 Views)

 

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

HFZ
0 Kudos
Message 9 of 21
(4,545 Views)

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.

0 Kudos
Message 10 of 21
(4,519 Views)