Perlfunc: mysql_date
sub mysql_date {
my ($inc_time,$epoch) = @_;
$epoch ||= time();
my @date = localtime($epoch);
my $ret = sprintf("%04d-%02d-%02d", $date[5] + 1900, $date[4] + 1, $date[3]);
if ($inc_time) { $ret .= sprintf(" %02d:%02d:%02d", $date[2], $date[1], $date[0]); }
return $ret;
}