×
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

how to compare

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

RE: how to compare

Hi,

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,

glassesJust traded in my OLD subtlety...
for a NUance!tongue

RE: how to compare

(OP)
skip, thank you but I don't understand fully. I get the text and number part. I have come up with a way, may be long winded but this is how I've done it:

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

I'm using my iPad, so don't have the Extra VB Help reference.

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,

glassesJust traded in my OLD subtlety...
for a NUance!tongue

RE: how to compare

(OP)
skip I agree vba is better but does that not then involve using two programmes, Excel and attachamate?
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

In my experience, I'm providing data for my users. That ALWAYS involves Excel as the end product. So I never saw a benefit to using Extra VB. In fact it is an impediment, as I much prefer to drive a Cadillac than a Yugo!

Skip,

glassesJust traded in my OLD subtlety...
for a NUance!tongue

RE: how to compare

(OP)
skip I have tried your code and can see that it gets the last working day of the month. I think it uses Monday to friday as the working week which is fine. i can not work out how to modifiy the function to give me the next working day's date after today not matter what day today is.

could you give me some more guidence?
thanks
smiler44

RE: how to compare

(OP)
skip i also read the extra help on dateserial. i did not understand it

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

Well, instead of the LAST day of the month, use your date. The procedure loops, incriminating the day until a working day of the week is encountered.

Skip,

glassesJust traded in my OLD subtlety...
for a NUance!tongue

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members! Already a Member? Login

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close