08-04-2015 06:27 AM - edited 08-04-2015 06:27 AM
Hello
The attached screen capture is a multi line string of test results. Each line of the string consists of a date, time and a few numbers which represent the results.
How can I split this string into 2 strings at the arrow indicated, which is where there is a gap of more than 5 minutes between the timestamps?
Thanks
Solved! Go to Solution.
08-04-2015 07:06 AM - edited 08-04-2015 07:10 AM
08-04-2015 08:42 AM
To add on to jcarmody's post:
Since it looks like your end goal is to split the string, you'll need to output the index of the line that resulted in a True value. Use that index to split the string at a specific line and off you go.
It seems like a lot of work just to split a string, but converting to a timestamp is necessary if you need to perform operations based on those timestamps.
Cheers
--------, Unofficial Forum Rules and Guidelines ,--------
'--- >The shortest distance between two nodes is a straight wire> ---'
08-04-2015 10:02 AM
I have maneged to implement this and get it to work, even I don't yet fully understand the string format notation. Many thanks for the suggestion.
08-04-2015 10:08 AM - edited 08-04-2015 10:19 AM
The format is a timestamp because it uses "%<" and ">T" to surround the sub-format that defines the timestamp within the string.
Within the timestamp format, there are instances of hour/minute/second/etc values that it looks for within the string. Everything with a "%" in front of it is a numeric value. Everything else is a delimiter specific to the string.
Simple Example:
String: "4:30"
Format String: "%<%H:%M>T"
It uses the colon in the format string to understand where a colon would be found in the timestamp.
Alternatively, you could use "0430" and "%<%H%M>T" and get the same result (but only if the "04" is two digits instead of one)
Cheers
--------, Unofficial Forum Rules and Guidelines ,--------
'--- >The shortest distance between two nodes is a straight wire> ---'
08-05-2015 03:44 AM
Thanks James
I'm struggling to understand what the "%p" does in "%<%d/%m/%Y %H:%M %p>T".
The Labview help suggests that the %p defines the precision. However when I change the %p to %.2p, or any other value instead of 2, the precision of the result does not change.
The reason I'm looking at this is because I would like the resulting string to look like "dd/mm/yyyy hh:mm:ss", not "dd/mm/yyyy hh:mm:ss.000" i.e. I don't want the 3 decimal places after the seconds.
Am I on the right track in thinking that %p controls the precision of this, or is it done differently for a time vaule?
08-05-2015 06:48 AM - edited 08-05-2015 06:49 AM
08-05-2015 07:59 AM - edited 08-05-2015 08:05 AM
@tone5 wrote:
The reason I'm looking at this is because I would like the resulting string to look like "dd/mm/yyyy hh:mm:ss", not "dd/mm/yyyy hh:mm:ss.000" i.e. I don't want the 3 decimal places after the seconds.
Am I on the right track in thinking that %p controls the precision of this, or is it done differently for a time vaule?
"resulting string" What resulting string?
From jcarmody example, you have strings that are converted to a Numeric Time Stamp (number of seconds)
Are you talking about a Time Stamp Control that you have placed on your VI?
I think you will also need to use the following format string
%<%m/%d/%Y %H:%M.%S>T
I assume the decimal point in your time strings does not mean fractional minutes, but seconds
08-06-2015 08:21 AM
Thanks Omar and jcarmody; that's useful information.