06-08-2015 05:16 AM
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
06-08-2015 06:04 AM
Convert String to Timestamp and subtract both as you can find in example
06-08-2015 06:12 AM - edited 06-08-2015 06:16 AM
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.
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