取消
显示结果 
搜索替代 
您的意思是: 

date comparison

已解决!
转到解答

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

下载全部
0 项奖励
1 条消息(共 20 条)
6,435 次查看
解答
已被主题作者 rayclout 接受

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.

Date Parser.png



Mark Yedinak
Certified LabVIEW Architect
LabVIEW Champion

"Does anyone know where the love of God goes when the waves turn the minutes to hours?"
Wreck of the Edmund Fitzgerald - Gordon Lightfoot
2 条消息(共 20 条)
6,420 次查看

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

0 项奖励
3 条消息(共 20 条)
6,410 次查看

Answered my own question....drag the bottom of the vi down to expand....simple

0 项奖励
4 条消息(共 20 条)
6,403 次查看

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.

0 项奖励
5 条消息(共 20 条)
6,402 次查看

Phillip

That process doesn't work for me.

 

See attachment for what drops onto my BD

 

R

0 项奖励
6 条消息(共 20 条)
6,397 次查看

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

 

 

下载全部
0 项奖励
7 条消息(共 20 条)
6,388 次查看

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.

0 项奖励
8 条消息(共 20 条)
6,376 次查看

 


@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 难过表情

0 项奖励
9 条消息(共 20 条)
6,356 次查看

Ravens Fan

Where did I mark my message as the solution and not Marks?

 

I must be going blind

0 项奖励
10 条消息(共 20 条)
6,341 次查看