From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Convert number to correct time

Hello,

 

I am trying to convert a number string to a time stamp, however, for some reason, the first number in the string array is outputting the wrong time.  It should actually be 11:00:00 AM but instead it reads 10:00:00:913 AM.  Can you tell me how I can fix this code so that the correct time of 11:00:00 AM is output for the first element in the output Array?  Thanks.

0 Kudos
Message 1 of 7
(6,063 Views)

Where did these original values come from?

0 Kudos
Message 2 of 7
(6,042 Views)

hiNI wrote:  It should actually be 11:00:00 AM but instead it reads 10:00:00:913 AM.

Sounds like Daylight Savings Time and/or time zone is effecting your display.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 3 of 7
(6,020 Views)

Hello,

 

The data is originally read from a text file.

 

Thanks.

0 Kudos
Message 4 of 7
(6,019 Views)

Is there a setting to adjust for this?

 

Thanks.

0 Kudos
Message 5 of 7
(6,017 Views)

You say that the data is read from a text file, yet your array is not Array of Strings, but Array of Dbl.  Your conversion of Strings to Dbl is clearly wrong (and probably not necessary -- you should be able to go directly from a Date/Time String to a TimeStamp), but without seeing all your code, it is difficult to identify where you made the mistake.  Are you, by chance, in Daylight Savings Time?  [You might not be in the US ...]

 

Bob Schor

 

Message 6 of 7
(6,014 Views)

Besides any discussion Bob is introducing, i assume that you are running into a time zone configuration issue.

LV reads time zone configuration from the OS when LV is launched. All the time indicators are using this information to "correct" time stamps to the local time zone.

When you change your time zone in the OS and re-run the VI without restarting LV, you still get the same time display. When you re-start LV in between, you will get a different time display. This holds true at least for standard coniguration of time indicators which is "use system time format".

 

Conclussion: It is expected behavior.

 

Norbert

 

Norbert
----------------------------------------------------------------------------------------------------
CEO: What exactly is stopping us from doing this?
Expert: Geometry
Marketing Manager: Just ignore it.
Message 7 of 7
(5,999 Views)