how to compare
how to compare
(OP)
minds gone blank. I have scraped some text from my screen 22/12/13 and want to compare it to todays date.
todays date will change day by day and so will the text I scrape from my screen. how to I compare the two to see
if the date (text) I have scraped from by screen is less than todays date?
also dim variable name as date does not work, I'm sure it should. how do you declare a variable as a date?
thanks
smiler44
todays date will change day by day and so will the text I scrape from my screen. how to I compare the two to see
if the date (text) I have scraped from by screen is less than todays date?
also dim variable name as date does not work, I'm sure it should. how do you declare a variable as a date?
thanks
smiler44
RE: how to compare
EVERYTHING, that is every piece of data that you scrape from a terminal emulator, is TEXT.
A date is a NUMBER.
so you must parse the string into year, month and day, and use a date() function to convert to a number (real date). Of course you must add the century to the year.
Skip,
Just traded in my OLD subtlety...
for a NUance!
RE: how to compare
scraped data/date = 25/12/13
todays date = 05/01/14
I compare the 13 to the 14. 14 is greater, no more checks use the 05/01/14 date
if 13 and 14 were equal then compare 12 and 01. 12 is greater, no more checks use date that has 12 in it
if 13 and 14 were equal and the 12 and 01 were equal then compare 25 and 05. 25 is greater use that date
if todays year is greater use that date
if years are equal then compare months, use the date with the greater month
if years and months are equal use the date with the greater day.
This has overcome one problem, leaves me with another that I may have the answer to. If using todays date and today is a Saturday or Sunday then use the date of the next working day. How do I get the next working day's date?
skip would like to see a full version of your way.
smiler44
RE: how to compare
Furthermore, I always use Excel VBA, light years better than Extra, to scrape, and all my data ends up in Excel anyhow.
That being said, check for DateSerial() function in Extra Help. This will return a Date Value (a NUMBER), that you can compare with your current date.
You really ought not compare year, month & day individually as you have described. CONVERT strings to Date Values (NUMBERS) for ANY date comparison or calculation!
Skip,
Just traded in my OLD subtlety...
for a NUance!
RE: how to compare
thread1-1503640: macro inlcude last businessday
Skip,
Just traded in my OLD subtlety...
for a NUance!
RE: how to compare
using two programs would not be very smooth. I have looked at the link you sent me and copied some of the code to try.
appreciate the help.
smiler44
RE: how to compare
Skip,
Just traded in my OLD subtlety...
for a NUance!
RE: how to compare
could you give me some more guidence?
thanks
smiler44
RE: how to compare
most of my stuff "does not require" excel as i dont have any reason to interact with it. to ask users to open excel to run a macro in attachmate when they hve no data to be used from or entered into excel, i dont go with this.
smiler44
RE: how to compare
Skip,
Just traded in my OLD subtlety...
for a NUance!