in reply to Converting localtime to SQL format

Nobody has mentioned yet Time::Piece::MySQL, which makes localtime() return an object, so you can just do this:

use Time::Piece::MySQL; print localtime->mysql_datetime."\n"; print localtime->mysql_date."\n"; print localtime->mysql_time."\n";

I generally prefer this to NOW() because I'm usually working with Class::DBI objects, rather than building my own queries, and you have to jump through hoops to get NOW() in there without getting quoted.


We're not surrounded, we're in a target-rich environment!