01-16-2016 01:18 PM
HI expert of labview and other member's
in one project I need to regard solar calendar for showing data in the chart but as you know time in time stamp of labview start from 1904 and is Gregorian calendar and could not show for example 1394 as solar calender
anybody know how I can change them for appropriate mode
Solved! Go to Solution.
01-16-2016 03:56 PM
01-16-2016 04:53 PM
so what about the chart and waveform about the date that show
01-16-2016 07:07 PM
01-17-2016 09:48 AM
The Conventional Wisdom is that you cannot express dates before 1 Jan 1904 in LabVIEW, as the TimeStamp records seconds since this Day 0. Have you ever tried? I hadn't, but, being a Scientist and a card-carrying mathematician, I said "Why not?, and did the experiment.
The Conventional Wisdom is wrong! Negative Numbers are just fine as mathematical objects. For example, if time is reckoned as seconds from midnight 1 Jan 1904 (UTC, so in New York, it would be UTC-5 or 7:00:00 PM, 31 Dec 1903), then 86400 seconds earlier, or at "Time -86400" we should get 7:00:00 pm, 30 Dec 1903. Here's a Snippet you can try, with the observed "answer" shown as a Comment:
Here's another example. How many days are there between 1 Jan 1800 and 1 Jan 1900? Before doing the test, let's predict the answer. That's 100 years, or 365 *100 = 36500. But there are leap years every 4 years, so we need to add 25 days to get 36525. Ah, but then there's the Gregorian Calendar, which says Leap Centuries are not Leap years (unless they are also divisible by 4, as was Y2K), so 1 Jan 1800 wouldn't be a Leap year, so we over-counted by one, and the answer should be 36524. Anybody care to guess what happens if we "do the Experiment"?
Yes, we get the "right answer". What happens if you go back really far, say to the 1700's, when the Gregorian Calendar was adopted (and why Washington's Birthday "moved" to 22 Feb), I don't know (I didn't do the experiment yet).
So be courageous, Grasshopper, and treat TimeStamps as any other number, one that can take on negative values just fine. And Kudos to the NI Engineers who built this flexibility into LabVIEW!
Bob Schor
P.S. -- the Gregorian Calendar was "invented" in October, 1582, but not adopted by the US until September, 1752.
01-17-2016 12:20 PM
hi thank you for your answer Bob
but my problem is that I want to show some data in the solar calender solar calender is 622 fewer that 2016 calender for example now it is years of 1394
for solar calender and I could not show data in this format of date and time in the waveform because labview could not support such format
01-17-2016 12:43 PM
01-17-2016 01:24 PM - edited 01-17-2016 01:26 PM
Well, according to Wikipedia, Win32 and Win64 won't handle dates before 1 Jan 1601, noted as the beginning of the first 4-century Gregorian Calendar sequence. Further experimentation with LabVIEW shows that the TimeStamp will go back to 1 Jan 1600, but if you try to get "the day before", the arithmetic works, but converting the answer to a TimeStamp and trying to display it (by wiring it to a TimeStamp indicator) returns an "initialized" value (i.e. the date shows a MM/DD/YYYY). Nevertheless, the problem is only one of representation -- the numbers are still valid.
Indeed, you can use LabVIEW's Seconds to Date/Time function even for dates older than 1 Jan 1600, as this Snippet illustrates.
I wonder if it will work for 1 Jan 1394 ... Since I know I can't "see" dates that far back, I can "probe" for whether the values that LabVIEW carries are valid by, say, adding 3 centuries of days to 1 Jan 1394 and see if I get a date near 1 Jan 1694 when I cast the answer to a TimeStamp (I may be off a few days because of uncertainty of the Gregorian/Julian Calendar Switch).
Yep, it still works! The only drawback with using times going back a few centuries is that you need to (a) decide how to handle dates that predate the Gregorian Calendar (and its variable adoption), and (b) you will need to use Date/Time Records and do the formatting yourself to handle Date Input and Output.
Bob "(Almost) Anything Is Possible With LabVIEW" Schor
P.S. -- before you bombard me with "But what about THIS? (for example, displaying Timestamps on Waveforms), note the "Almost" in the modified signature ...
01-18-2016 01:45 AM
I assume you want the Hijri calendar (not just "the solar calendar"). LV doesn't have direct support for this, and as far as I can tell, even though you can configure Windows to use other calendars and configure LV to use the system settings, LV will still only take the Gregorian calendar values from the OS.
What you will probably want to use is this .NET class, which apparently can give you the data you want - https://msdn.microsoft.com/en-us/library/system.globalization.hijricalendar%28v=vs.110%29.aspx
I haven't tried using it myself, but it should probably be simple enough if you know how to use .NET in LV. If you don't, look up some examples.
As for showing it on a graph, the LV graphs only allow numeric values for their axes. LV knows how to format these numbers in a few ways, but those are limited. My suggestion would be one of the following:
01-19-2016 05:04 AM
I remembered a couple of other options, but looking at the thread again, my understanding is that you're probably using the Persian calendar, not the Hijri one, but that just means you need to select the relevant class.
The other options are: