LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Converting a string to a time stamp variable

Hi, I found that using the default time stamp (seconds from 1904) for all your data makes things much easier. Simply change the string (seconds) to time stamp with the string to time stamp under timing palet. This creates a time stamp from the string which you can wire into x-y graph. There is a property of the graph which will convert the time stamp into whatever format you want.  Just click on x-axis and go to format precision and click absolute time. It will auto convert
0 Kudos
Message 11 of 19
(11,275 Views)


@resrchengee wrote:
...Simply change the string (seconds) to time stamp with the string to time stamp under timing palet....
"string to timestamp"?
0 Kudos
Message 12 of 19
(11,267 Views)
Where do you see a "string to time stamp" function on the timing pallette?  The only thing I see is seconds (double) to time stamp (at least in LV8.2).  The thread was based on taking a string such as "8/30/07 11:42 pm" and converting that to a valid timestamp. 
0 Kudos
Message 13 of 19
(11,264 Views)
ahh my apologies .. I meant string to dbl then dbl to time stamp.
0 Kudos
Message 14 of 19
(11,246 Views)
This is really the kind of thing that should be built into LabVIEW, since it's a very common task and its not particularly easy (at least if you want to support a wide range of input).  Excel does a pretty good job with this, but LabVIEW doesn't even try. I encourage you to request it at the project suggestion center. 

http://digital.ni.com/applications/psc.nsf/default?OpenForm


0 Kudos
Message 15 of 19
(11,235 Views)


@resrchengee wrote:
ahh my apologies .. I meant string to dbl then dbl to time stamp.


That doesn't make any sense either. For this to work, your string would need to be the number of seconds since 1904, not a date time string.

___________________
Try to take over the world!
0 Kudos
Message 16 of 19
(11,229 Views)

@jdunham wrote:
This is really the kind of thing that should be built into LabVIEW,

It is. Since 8.0, the Scan from String function can do the same thing as the VI I posted earlier in the thread.

___________________
Try to take over the world!
0 Kudos
Message 17 of 19
(11,228 Views)

A simple solution is the use of datetime.parse(String, IFormatProvider) from .NET Framwork 2.0

 

So you can select a specific culture (I didn't found that in Labview)

 

1.  Constructor Node: Assembly mscorlib 2.0.0.0, Object: System.Globalization -> CulturInfo(String name)

Culture/Language Name:

(empty string): Invariant culture

"en-US":  English (United States)

 

2.  Invoke Node, Assembly  mscorlib 2.0.0.0, Object System -> static Method DateTime.Parse

s:  string containing a date and time to convert.

provider : IFormatProvider from 1.

 

0 Kudos
Message 18 of 19
(10,445 Views)
Thank you Peter for this interesting and comfortable alternative to 'scan from string'. I tested it and it works. Unfortunately it works slow for batch conversioning. I attached a vi where I benchmarked the conversioning routines. I thing this is still a problem between labview typsystem and dot.net CTS.
0 Kudos
Message 19 of 19
(10,285 Views)