Fixed timestamp formatting to be consistant

This commit is contained in:
bluesaxman 2021-05-07 13:48:56 -06:00
parent bafea55632
commit 35300bae9b

View File

@ -20,7 +20,7 @@ print "Confirming this is your post:\n".$post."\n Is this correct? (you must typ
if ( <STDIN> =~ /y(es)?/i ) {
#this needs to be called right before the post is submitted to the database.
my ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime();
my $timeStamp = $mday."/".$mon."/".($year + 1900)." ".$hour.":".$min.":".$sec;
my $timeStamp = sprintf("%.2d/%.2d/%.4d %.2d:%.2d:%.2d", $mday, ($mon + 1), ($year + 1900), $hour, $min, $sec;
my $statmentHandle = $db->prepare('INSERT INTO posts VALUES( ?1, ?2, ?3)') or die $DBI::errstr;
$statmentHandle->execute( $timeStamp, $username, $post ) or die $DBI::errstr;