02-16-2011 04:08 PM
Hello All
The attached vi searches a directory which contains txt files with the name format File_2011.02.17.txt...viz the file is named on the date it is created.
The purpose of the directory search is to determine if a file already exists....if it doesn't, then something else happens (this part of the code is not included nor is it relevant)
The date part of the file is created using the Get Date/Time in seconds format.
After searching the directory and finding the latest txt file I am then attempting to compare it with the current date.
This is where I'm having a little trouble, and would appreciate any assistance.
I'm sure it's a very minor thing to do, but I've always had trouble with timestamps, dates etc.
Thank you and best regards
Ray
Solved! Go to Solution.
02-16-2011 05:13 PM
You can use a simple regular expression to extract the date components from the file name. Then you can convert them to numbers and compare then at will. I would recommend calculating a Julian date from the components so you only need to do one comparison.
02-16-2011 06:50 PM
Hello Mark
Firstly thank you for your interest
I assume the function you have used here is a Match Regular Expression. I'm using LV2009 on XP, and this function I have looks different to yours. For a start it doesn't have the three seperate string outputs on the right hand side, but rather....before match, whole match and after match.
Am I missing something here?
Ray
02-16-2011 07:09 PM
Answered my own question....drag the bottom of the vi down to expand....simple
02-16-2011 07:10 PM
The Regular Expression function can be expanded by grabbing the bottom of the function and pulling down (like many other LV functions)
You could also drag Mark's example from your browser and drop it on your block diagram, it's called a VI Snippet.
02-16-2011 07:18 PM
Phillip
That process doesn't work for me.
See attachment for what drops onto my BD
R
02-16-2011 07:34 PM
Mark
I took your advice on all counts and it works. It may be convoluted and a knight could do it in half as many functions (have a look) but it does work.
Thanks again
Ray
02-17-2011 12:18 AM
Then please give credit to Mark for giving you the solution by marking his message as the solution and not your own. You can unmark your message by going to the options menu to the upper right of your message.
02-17-2011 06:10 AM
@rayclout wrote:
Phillip
That process doesn't work for me.
See attachment for what drops onto my BD
R
I'm guessing you are using Firefox or Chrome. I think there is a known issue with these browsers. Internet Explorer should work.
By the way, I just upgraded my home laptop to IE 9 and now I can't drop a snippet using IE either
02-17-2011 02:05 PM
Ravens Fan
Where did I mark my message as the solution and not Marks?
I must be going blind