LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Concatenated string to time and date

Hi,

 

I'm attempting to use the Scan From String function to read a concatenated string as the time and date. 

 

The concatenated string is in the format of HHMMSSddmmYY, but I have only had luck in outputting as HH:MM so far. 

 

The string syntax I'm using is Time: %<%H:%M:%S%d/%m/%Y>T 

0 Kudos
Message 1 of 11
(3,741 Views)

Use %<%H%M%S%d%m%y>T

 

Your original string doesn't have colons and slashes, so neither should your format string.

 

Christmas day later this year.

Example_VI

Message 2 of 11
(3,737 Views)

One pm on Christmas morning^^

Thank you for the quick answer, I am always amazed of this forum. Hope the original poster sees it.


Ingo – LabVIEW 2013, 2014, 2015, 2016, 2017, 2018, NXG 2.0, 2.1, 3.0
CLADMSD
Message 3 of 11
(3,698 Views)

I wanted to pick a date that the user could see that the month/day shown on my timestamp is correct having been reversed from the European day/month.  I just picked Christmas, because hey, why not?  it is a good day.

I had also been using single digit months and days that would show up as a 04 (for April) in his code to make sure it read them properly

0 Kudos
Message 4 of 11
(3,690 Views)

Thanks for the speedy response RavensFan! 

 

It's got my date almost spot on, but it appears to be an hour out? 

 

I tried changing the y in the format string syntax to Y which changed it to 12, but then the year when to 1600 Smiley Frustrated

 

The concatenated string in coming from the concatenate string, even though it looks like its coming out of scan from string in the attached picture. 

0 Kudos
Message 5 of 11
(3,682 Views)

Attached picture**

0 Kudos
Message 6 of 11
(3,681 Views)

It works fine for me.

 

It is possible your timestamp indicator is set for a different timezone setting than your local timezone?  Is your timezone GMT -1:00

 

Why are you only taking the first 6 characters of your number and concatenating a different string to it?  (But that wouldn't affect the results you are seeing.)

0 Kudos
Message 7 of 11
(3,673 Views)

Strange, what version of Labview are you running?

 

The time is coming from a NMEA sentence from a GPS, which gives time up to ms. The first 6 characters of the time are taken (HHMMSS) and concatenated to the date from the GPS (DDMMYY), to give the overall time and date. 

 

I'm in BST right now, but the time is reading from the GPS which is UTC (once it finds a fix) 

0 Kudos
Message 8 of 11
(3,664 Views)

I'm using LV 2018, and I'm in Eastern Daylight Time.  UTC -04:00  for the summer.

 

I googled and saw BST means British Summer Time and that it is 1 hour ahead of UTC.  So that explains a 1 hour difference, but then again, perhaps it is in the wrong direction.

 

It would be best if you attached the actual VI so I can see the timestamp display settings and play with it.

 

 

0 Kudos
Message 9 of 11
(3,656 Views)

The scan from string function is *not* "adjusting" your time.

My guess is that your Labview Time Stamp format is wrong.

 

image.png

---------------------------------------------
Former Certified LabVIEW Developer (CLD)
0 Kudos
Message 10 of 11
(3,655 Views)