comparing dates

Technical support and scripting issues

Moderators: Dorian (MJT support), JRL

Post Reply
Tourless
Pro Scripter
Posts: 69
Joined: Wed Jun 14, 2017 1:53 am
Location: NY

comparing dates

Post by Tourless » Wed Jul 21, 2021 6:33 pm

Hi Folks.

Continuing along in my quest, I'm currently looking to compare the newest file date in a given folder to the today's date. To test I have the following...

Code: Select all

Month>varMonth
Day>varDay
Year>varYear
GetNewestFile>T:\d1\d2\*.csv,strFileName
FileDate>%strFileName%,dFileDate
Let>dateCheck=%varYear%%varMonth%%varDay%
If dFileDate=dateCheck
MessageModal>File Date Matches.
endif
I've tried it with and without adding the dateCheck but I don't think it likes the variables. At least it's not passing over my if statement as it should (mydFileDate is 20210720 and dateCheck is 20210721). Is it a variable thing or am I missing something? Is there a better way to check if a file was created today and take action if it was and another action if it was not?

User avatar
JRL
Automation Wizard
Posts: 3497
Joined: Mon Jan 10, 2005 6:22 pm
Location: Iowa

Re: comparing dates

Post by JRL » Wed Jul 21, 2021 8:34 pm

Your code works for me when I fix it.
You are missing a ">" in the "If" line.

Tourless
Pro Scripter
Posts: 69
Joined: Wed Jun 14, 2017 1:53 am
Location: NY

Re: comparing dates

Post by Tourless » Wed Jul 21, 2021 8:51 pm

That's what I get for staring at it for too long. -Thanks JRL

Post Reply
cron
Sign up to our newsletter for free automation tips, tricks & discounts