Adding date condition to SS script

I would like to compare a record search scraped date string with the current date and then decide if a detailed scrape will be performed.

Would it be possible to get the Interpreted Java code?

Data record date has the following format MAY-20.

Thank you!

Adding date condition to SS script

Hi Noelle,

Thank you for your reply.........

works great!!

Please check your inbox.

Have a great day!

Rob

great =)

That helps me lots, just one more thing: How can I add the time?
I don't get past this one: d = d.substring(4,10);

Thanks in advance

r0tzl0effel

Adding date condition to SS script

Hi Noelle,

Thank you for your reply.

Sorry for the confusion.

I already have several working scraping sessions.

I am trying to reduce the run time by implementing an if statement at the top of a scrape details script and just need some InterpretedJava help.

Basically I want to check if an extractor pattern token matches a date value.

I do not have a lot of Java programming experience, just PHP.

Here is what I have tried without success:

String str = "MAY-20";

if(dataRecord.get( "DATE" ) == str )
{
session.scrapeFile( "details page" );
}
else
{
session.scrapeFile( "search results" );
}

In this case I am specifying the date, however the final solution should get the current date.

I have also tried your solution to a previous post:

import java.util.Date;
Date date = new Date();

if(dataRecord.get( "DATE" ) == date )
.
.
.
.

I understand that either the DATE token or the date returned from the javascript will have to be properly formatted.

The DATE token is the string MAY-20 (MONTH-DAY format)

Thank you for any assistance,

Rob