LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

String to TimeDate conversion

Hi,

I have a string like

20041002211500 (14 digit YYYYMMDDHHMMSS)

I want to get the Day of the year. I know I can use Format Date/Time String
with %j and get the output.

But, I cannot convert the string into TimeDate format.

How can I do that?

TIA
0 Kudos
Message 1 of 4
(2,697 Views)
I am not sure if I follow you.

The attached jpg illustrates how to use the "scan from string" to pull out the fieds of the string as intergers.

These intergers are then bundled and passed to the "Date/Time To Seconds" function which then returns the time as navtive LV time format.

Note:
Prior to LV 7.0 the time was returned as a number.

Ben
Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
0 Kudos
Message 2 of 4
(2,697 Views)
You already posted the same question one week ago, and you got the same answer as given by Ben above. So, I suppose that your question was not fully understood. Could you be more explicit ? For instance, where did you get the date-time string from ? What further processing do you want to do with the results ?
Chilly Charly    (aka CC)
0 Kudos
Message 3 of 4
(2,697 Views)
The %j will give you the day of the year. Your problem is to convert your string into a time/date format. The attached vi shows how. Basically you need to split your string using Scan From String into the different fields (MM/DD/YY/hh/mm/ss), then bundle these into the time/date cluster, then wiring the cluster into the Date/Time to Seconds function. The output of Date/Time to Seconds is then wired into the Format Date/Time String function. You can create the time/date cluster by right clicking on the input terminal of Date/Time to Seconds and selecting Create Control.
- tbob

Inventor of the WORM Global
0 Kudos
Message 4 of 4
(2,697 Views)