LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

how to find greater among two time/date string

HI All,

 

if I have two Date/time string  , In that how to find which is greater time and smaller time ?.

 

How to substract smaller time from greater time and result should be in seconds.

 

Kinldy suggest me , if anyone tried this.

 

I calculated the current date/time string  as shown in vi.

 

 

 

Regards

Punith

0 Kudos
Message 1 of 3
(3,452 Views)

Convert String to Timestamp and subtract both as you can find in example

0 Kudos
Message 2 of 3
(3,441 Views)

LabVIEW timestamps are numeric values, counted in seconds since Jan 1, 1904.

 

http://www.ni.com/tutorial/7900/en/

 

 

You can use the LabVIEW comparison functions with timestamps.

 

timestamp comparison.png

 

To compare two strings that contain date/time information, you will need to convert the strings to numbers.

 

This can be done in several ways, but I prefer to use the Scan from String function.

 

Your format string is incorrect. The month and day formatters should be lower case. I can't say I've ever seen anyone use a dash as a separator between hours, minutes and seconds. The typical delimiter is a colon ( : )

 

I would expect a date time string to look something like 2015-06-08 07:04:45

 

To scan this as a LabVIEW timestamp, you would use the format string %<%Y-%m-%d %H:%M:%S>T

 

timestamp comparison 2.png

 

0 Kudos
Message 3 of 3
(3,437 Views)