LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Comparing Dates

Hi,
 
I'm trying to run a VI which will read a directory and convert to a string array and then use the current date to filter out directories which have been modified or added since the current date within  a user defined period e.g. 5 days.
 
I've managed to work out how to format the directory listing into an array and now want to do the compare stage. What would be the best way to compare the extracted date string from my directory listing with the current date? I've looked through the library of tools and there doesn't seem to be a simple solution.
 
Anyone got any experience in working with date manipulation/comparison who could help?
 
Many thanks for reading, I'm using LabVIEW 7.1.
 
Cheers
0 Kudos
Message 1 of 5
(3,195 Views)
Hi Rich,
I cannot convert to 7.1, however i have attached what seems like what you want.  You will not have the recursive file list vi, but you have already stated that you have the file list in an array.
 
Chris Co.
Message 2 of 5
(3,169 Views)
Hi!

Here an example which scan all directories in a directory and gives out if they were modified after "Current Time -5 days"

Best regards
Ken
Message 3 of 5
(3,163 Views)

Hi Rich_E,

When comparing times where the difference I'm looking for is shortish, I just build up the difference in seconds, (5 days = 5 * 24 * 60 * 60 seconds) and compare the appropriate date/time in seconds values.

I assume that you will have a U32 for the file's date/time.

Now get current date/time (also a U32)

Both times represent the number of seconds that have elspased since a time before PCs existed (atcually 00:00:00 GMT on 01 Jan 1904, but that doesn't matter for this test). The difference between the two values you have is the the age in seconds you're looking for.

You may also find the seconds to date/time and time/date to seconds vi's useful. The LabVIEW help on these explain their usage well. If you want to base your comparison on a perticular time of day rather that the exact number of seconds you might like to get the date/time, update particular values and convert back to a time in seconds. It will happily treat a setting of 35 January as being 04 February so you don't have to be too particular in what you set.

Rod.

 

Message Edited by Rod on 01-15-2007 01:21 PM

Message 4 of 5
(3,163 Views)

All,

Many thanks for your prompt responses! KenT's solution seems like the easiest and most straightforward for what I'm after though all the information posted is very interesting!

Many thanks, you've all helped save the day! 😉

0 Kudos
Message 5 of 5
(3,147 Views)