LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Reverse of "Format Date/Time String.VI"

I'm looking for a VI that does the reverse job of the

Format Date/Time String, i.e. converts a string with a date

and a time, and with an time format-string input that describes

the format of the string, and gives a time stamp as output.

Anybody done this one ?

Martin
0 Kudos
Message 1 of 5
(3,883 Views)
Very simple; just wire the string to a scan from string function and extract the month, day, year, hours, minutes and seconds as separate numbers.

Now the date/time to seconds function takes a cluster of these numbers and converts it to a timestamp so all you need is to bundle the numbers into that cluster and give it to the date to seconds function.
0 Kudos
Message 2 of 5
(3,883 Views)
This is of course assuming you have a particular known format of the time and date string to be converted. Otherwise different time display formats can mess with the conversion,

is 01/02/03 the 1st of February 2003 or the 2nd of January 2003? Dependson whether you live in the USA or not I guess...... Not to mention that the days and months can be spelled differently in different languages if you have a verbose time/date string to convert.

Just my thoughts on the subject.

Shane.
Using LV 6.1 and 8.2.1 on W2k (SP4) and WXP (SP2)
0 Kudos
Message 3 of 5
(3,883 Views)
Building that cluster requires that you enter which day of the year it is. As far as I can tell labview doesn't have a vi for that.
0 Kudos
Message 4 of 5
(3,883 Views)
No, it doesn't. If you check the online help for Date/Time to Seconds it clearly states that 'day of year' is ignored.
0 Kudos
Message 5 of 5
(3,883 Views)