11-01-2016 07:23 AM
Im trying to create a labview program where the user can set the time for a led to be triggered. I want to compare the time the user has selected to the current time but cant seem to get this working. I also want to do it without using the date, seeing as this is going to be a daily event.
This is what I got, but cant make the time match:
11-01-2016 07:38 AM
Think about what you are asking. You want to compare two TimeStamps, which represent instants in time (that, of course, includes the date, since an instant yesterday can never match an instant today -- it is forever "yesterday"). The TimeStamp represents this instant as precisely as possible, perhaps down to the nanosecond.
What question do you want to ask? How closely do you want to "match" a time (to the hour, minute, second, millisecond, microsecond)? Do you want just time (as you state)? Can you think of how you would compare the TimeStamp representing 10:13am yesterday with the TimeStamp of 10:13am today? [Hint -- what is the difference between them, and can you generalize this question?].
Bob Schor
11-01-2016 07:55 AM
It just occurred to me that I can format the timestamp:)
11-01-2016 08:05 AM
Yes, you could do that. You could also use LabVIEW Help to see that a TimeStamp is a number that represents something. If you have numbers, you can do arithmetic on them. If you want to see if two numbers are equal, you can compare them. If the two numbers happen to not be integers, then you need to understand what it means to compare them.
"LabVIEW calculates this timestamp using the number of seconds elapsed since 12:00 am, Friday, January 1, 1904, Universal Time".
Bob Schor
04-06-2017 10:00 AM
The attached VI could work if just compare time.