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;
}


Note: Replies will be formatted with PHP Markdown Extra syntax.

Name: Email (Not Required):
 
Logged IP: 18.190.158.237
To prevent spam please submit by clicking the kitten: