Fixed timestamp formatting to be consistant
This commit is contained in:
parent
bafea55632
commit
35300bae9b
@ -20,7 +20,7 @@ print "Confirming this is your post:\n".$post."\n Is this correct? (you must typ
|
|||||||
if ( <STDIN> =~ /y(es)?/i ) {
|
if ( <STDIN> =~ /y(es)?/i ) {
|
||||||
#this needs to be called right before the post is submitted to the database.
|
#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 ($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;
|
my $statmentHandle = $db->prepare('INSERT INTO posts VALUES( ?1, ?2, ?3)') or die $DBI::errstr;
|
||||||
$statmentHandle->execute( $timeStamp, $username, $post ) or die $DBI::errstr;
|
$statmentHandle->execute( $timeStamp, $username, $post ) or die $DBI::errstr;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user