reformatDate in session variable?

I've got a bunch of dates being scrapped which are targeted for a MySQL table. However, they need to be reformatted before insert.

Since I'm a noob O-O/Java type, I'm probably missing something but I don't understand why this doesn't work:

session.reformatDate(session.getVariable("FILINGDATE1"), "MM/dd/yyyy", "yyyy-MM-dd");

Please post or e-mail me if you can suggest syntax that works!

TIA.

Dave Nuttall
San Antonio, TX

reformatDate in session variable?

[quote="todd"]I think you just need to get the reformatted date from that method call, and set it again on your session variable.[snipped][/quote]

THAT WORKS VERY WELL, Todd!

Thanks.

For what it's worth to others who may struggle with this scraping-to-databases thingy, I wanted to write my output to SQL inserts instead of the oft mentioned CSV concept since in my experience it's been more portable than making the web-server scripts create the "load from file" instructions compared to SQL "insert" instructions.

The problem was that the extractor grabbed the date data in the "06/15/2007" style and we're using MySQL where it normally expects date data to be in the "2007-06-15" structure.

And with 14 of 80 fields in my scrape, I wanted to reduce the number of steps formatting the data as practical.

I'm not expert with SS, but will be happy to help if you're struggling with the usage of SS output where your other tools are PHP and MySQL.

Best regards to all.

Dave

reformatDate in session variable?

Hi,

I think you just need to get the reformatted date from that method call, and set it again on your session variable. Maybe something like this:

reformattedDate = session.reformatDate(session.getVariable("FILINGDATE1"), "MM/dd/yyyy", "yyyy-MM-dd");
session.setVariable( "FILINGDATE1", reformattedDate );

Kind regards,

Todd Wilson