LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

convert time stamp in chart for other kind of Calendar like solar calendar

Solved!
Go to solution

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 

0 Kudos
Message 1 of 14
(4,288 Views)
No... Time is what it is... If you know how to make the conversion you could encapsulate it in a VI and display the results in a string indicator.

Mike...

Certified Professional Instructor
Certified LabVIEW Architect
LabVIEW Champion

"... after all, He's not a tame lion..."

For help with grief and grieving.
Message 2 of 14
(4,256 Views)

so what about the chart and waveform about the date that show

0 Kudos
Message 3 of 14
(4,235 Views)
You would be out of luck. LabVIEW only supports the standard time representation.

Mike...

Certified Professional Instructor
Certified LabVIEW Architect
LabVIEW Champion

"... after all, He's not a tame lion..."

For help with grief and grieving.
0 Kudos
Message 4 of 14
(4,206 Views)

     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:

Time Stamp 1.png

 

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"?

Time Stamp 2.png

 

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.

Message 5 of 14
(4,156 Views)

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

0 Kudos
Message 6 of 14
(4,128 Views)
An additional problem is that the Iranian calendar also has a different starting point (in March?) and the lengths of the months are different. So I guess you could do the math so the timestamps look right, but it would be a far from trivial task.

Mike...

Certified Professional Instructor
Certified LabVIEW Architect
LabVIEW Champion

"... after all, He's not a tame lion..."

For help with grief and grieving.
0 Kudos
Message 7 of 14
(4,111 Views)

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.

Time Stamp 3.png

 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).

Time Stamp 4.png

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 ...

Message 8 of 14
(4,097 Views)

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:

 

  1. Use an external .NET control or web based graph that knows how to do this and embed it in your FP.
  2. Use the picture control VIs to draw the graph from scratch and put it the labels you want on the X axis. There are VIs for doing this, but I never used them.
  3. Use the Plot Picture property of the graph to overlay a picture of your scale on top of the graph. For this to work, you will probably need to take the various properties of the graph to know how to draw this scale using the picture control VIs.

___________________
Try to take over the world!
Message 9 of 14
(4,054 Views)

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:

 

  1. Calculate the correct date, then convert it to a timestamp in the Gregorian calender where the year only shows two digits (for instance, if your date is 15/06/1387, convert it to 15/06/2087), but one likely issue with this is that the months will probably not always have the same number of days.
  2. Place an array of strings over or near the graph (you can make them transparent) and set the value in them. The big problem with this is that it will be difficult to set correctly when the user scrolls around or changes the zoom.

___________________
Try to take over the world!
0 Kudos
Message 10 of 14
(4,007 Views)