Date formating incorrectly in with interpreted java

Having some problems with Interpreted Java. It is providing me a date approximately one month ago:

// get the date
Calendar date = Calendar.getInstance();

my system date is correct. Any suggestions? Thank you!

Date formating incorrectly in with interpreted java

Thanks for the reply Scott, I am using the JRE that came with the download. I noticed if I change my system date to one month from now (june) it puts the correct date in the output file.

I will read your blog entry to see if I can find the problem. thank you!

Date formating incorrectly in with interpreted java

colbrunn,

I'm not sure why this is happening to you. Are you using the JRE that came with screen-scraper or are you redirecting screen-scraper to use a different instance of Java on your machine?

Perhaps the problem lies in how you are reforming it for human-readable display?

We have a [url=http://blog.screen-scraper.com/2006/10/12/scraping-a-date-range/]blog entry[/url] that gives samples you can reference.

Here's a sample from one of my scrapes.

import java.text.*;

String dateFormat = "yyyy.MM.dd_HH.mm.ss";

Calendar rightNow = Calendar.getInstance();
Date endDate = rightNow.getTime();
SimpleDateFormat formatter = new SimpleDateFormat( dateFormat );
String searchDate = formatter.format( endDate );
searchDate = searchDate.replaceAll("\\/", "-");

session.setVariable("searchDate", searchDate);

outputDir = "commuterlink_" + session.getVariable("searchDate");
new File(outputDir).mkdir();

session.setVariable("outputDir", outputDir);

Hope this helps,

Scott