02-26-2019 10:07 PM
There are a few bugs in your program. The one that jumped out at me is that your DateTime Control to Date Time Record is doing manipulations on a string and assumes that the system time format is set up for a 4 digit year. My PC is set up for a 2 digit year so today is 2/26/19 on my system, but your string manipulation requires it to appear as 2/26/2019. As a result, it looks like the current age years is 429 millions years. There is already a time to Time record cluster function on the palette, why don't you use that?
I don't think you have a leap year problem, at least not in the way you are talking. Of course we did and should have had a leap year in 2000. I think the problem is that you assumed a year has 365.25 days. That might work if you had an an multiple of 4 years in the calculation, but you don't. Let's say you have a 7 year period of time. There may be 1 leap day in there or 2, depending on when the 7 year period starts and when it ends. If multiply 365.25 by 7, that .25 times 7 gives you 1.75. So that rounds up to 2 days, but perhaps you only have had 1. Or if you truncated 1.75 down to 1, but you might have had 2 leap days.
The fact is, you should just do math in time in seconds. Forget about age in months.
Spelling
subtract not substract
borrow not barrow
occurs not occures
intellectual not Intelectual
(bad spelling makes a program look sloppy)
03-17-2019 12:11 PM
What does the "Time record cluster function on the palette" Look like and where is it located in the Pallet?
Thanks,
Edmund
03-17-2019 02:00 PM - edited 03-17-2019 02:00 PM
Search for "Seconds to Date/Time" on the palette.
Or "Date/Time to Seconds"
04-07-2019 01:00 PM
All that does is return the date, with the offset of the year 1905, I have to subtract out the oddball date/time offset that makes up the second calendar which is based on an arbitrary date in the 20th century. In the end, I want to know the exact span of time for 2 billion seconds in years, months, days, hours, minutes, seconds.
04-07-2019 01:20 PM
Hi emw,
I want to know the exact span of time for 2 billion seconds in years, months, days, hours, minutes, seconds.
There is no "exact span" as that depends on the start date (as has been told several times before)!
The most "exact" you can get is "days, hours, minutes, seconds"…
04-07-2019 03:05 PM
It is easy to compute a date and time 2 billions seconds from "now" (turns out to be just after 7:30 pm EDT (UTC -4) on 22 August 2082. But if this was a Leap Year, the date would be different, and if it was a different month, the "day" could also be different. Now, if you define what you mean by "Day, Month, and Year", the problem becomes just doing arithmetic ...
Bob Schor
04-07-2019 05:47 PM - edited 04-07-2019 05:51 PM
I can calculate the date fine, but I'm trying to quantify the actual time in Years, Months, Days, Hours, Minutes and Seconds. But must first subtract out the time offset of the 1905 start date which is equal to the 0 second point. So if I do the calculation I end up being offset by that 5 years (1905). if I subtract out 1905, that should be some huge Negative seconds, then add the 1 billion seconds and take the difference. from 0 AD to 2 billion seconds.
I've been able to manually calculate the time span, I'm just trying to align my results to the official time keeping system inside of LabView/PC Clocking and dating system. Because there are all kinds of special exceptions to time and date keeping. Like the bizarre rules involving Leap Year, where by you get 1 extra day in February every 4th Year, unless it is at the end of the century, then you skip having Leap Year, even though it is evenly divisible by 4 every time. With one exception, if the Century is evenly divisible by 400 years, then you go ahead and have Leap Year. Which means in 1900 there was no Leap Year, but in 2000 there is a Leap Year because 2000 is evenly divisible by 400 years.
This is because a Year is not exactly 365 and 1/4th days, a 1/4th day should be 6 hours, but a Year is equal to 365 days, 5 hours, 48 minutes and 46 seconds. A little bit short of 1/4th a day... Is that discrepancy expressed in the time date (by second to Time) calculations?
04-07-2019 06:01 PM - edited 04-07-2019 06:04 PM
What is the Default 0 second Start date, isn't supposed to be January 1,1905 at 12:00am? Why such an odd ball date? Why not 0000 AD at 12:00am? Or is there too much missing time during the Dark Ages to be sure of when 0000 AD at 12:00am really was?
However when I do the calculation I end up getting 1905 added to the results, I have manually calculated the time span, I just trying to confirm that my calculations are in alignment with the LabView/PC Date time keeping system. And if the complex rules involving Leap Year are effecting the end result. Remember, I'm calculating time span, not date and time. But I must subtract out date and time of 2G seconds to determine the time span of 2 billion seconds. Otherwise the 1905 time enters into the result.
04-07-2019 10:08 PM
Actually it is January 1, 1904 midnight GMT I don't know where you get 1905 from.
Why is that odd? Excel bases it on January 1, 1900 local time. Many computer operating systems were based on different epochs. I want to say dates in 1970, maybe 1980.
The advantage of 1904 is it avoids an error that happens in Excel. Excel thinks that 1900 is a leap year, and it adds an extra day for February 29, 1900 which never existed.
Why not 0 AD? Actually there is no such think as 0 AD either. And probably NI picked 1904 (to avoid the 1900 non-leap year problem) to capture most of the century when computers where invented. Note that dates earlier than 1904 can still be handled. You can feed the timestamp functions negative values of seconds and they work backwards. Also, LabVIEW started on a Mac, and if you read the first link below, you'll see Apple Macs used the 1/1/1904 as the epoch. So naturally LabVIEW aligned itself with that.
But you still seem to be hung up on the concept of 2 billion seconds being something significant that will give you a consistent number of years, months, days, and we've explained multiple times that you can't easily compare a linear time value of seconds to a calendar so easily because there is no consistency in the number of days in a month, nor days in a year. Actually the number of seconds in any given year can vary when you throw in the concept of a leap second that gets added in occasionally.
https://en.wikipedia.org/wiki/Epoch_(computing)
https://en.wikipedia.org/wiki/Unix_time
If you add 2 billion seconds to the current timestamp, you'll get that date/time in the future. If you want to define how many years that is, go ahead does it matter if it is 1 day off (leap years) or 1 second off (leap seconds)? If you want to define it as months, than you need to define what a standard month is since it doesn't naturally exist.
04-07-2019 11:17 PM - edited 04-07-2019 11:17 PM
I believe NI’s date is based on the old Macintosh system. However, Apple probably chose that date to avoid the 1900 problem.
You could get a rough estimate for years by using 365.25 days in a year and a month as 1/12 of a year. But again, that would just be an estimate.
Chief LabVIEW Architect, Testeract | Owner, Q Software Innovations, LLC (QSI)
Director, GCentral | Admin, LabVIEW Wiki | Creator, The QControl Toolkit
Certified LabVIEW Architect | LabVIEW Champion | NI Alliance Partner