Skip to content
Extraits de code Groupes Projets
Valider 453e34d7 rédigé par Alexandre Morignot's avatar Alexandre Morignot
Parcourir les fichiers

fix db date format

parent 6ed1a681
Aucune branche associée trouvée
Aucune étiquette associée trouvée
Aucune requête de fusion associée trouvée
...@@ -13,16 +13,16 @@ sub exec { ...@@ -13,16 +13,16 @@ sub exec {
my $sth; my $sth;
if ($chan->[0] =~ /^#/) { if ($chan->[0] =~ /^#/) {
$sth = $dbh->prepare_cached('SELECT id, title, date, place, description, link $sth = $dbh->prepare_cached('SELECT id, title, DATE_FORMAT(date, "%d/%m/%Y"), place, description, link
FROM sam FROM sam
WHERE date > ? WHERE date > NOW()
ORDER BY date ORDER BY date
LIMIT 2' LIMIT 2'
); );
} else { } else {
$sth = $dbh->prepare_cached('SELECT id, title, date, place, description, link $sth = $dbh->prepare_cached('SELECT id, title, DATE_FORMAT(date, "%d/%m/%Y"), place, description, link
FROM sam FROM sam
WHERE date > ? WHERE date > NOW()
ORDER BY date' ORDER BY date'
); );
} }
...@@ -32,7 +32,7 @@ sub exec { ...@@ -32,7 +32,7 @@ sub exec {
return; return;
} }
$sth->execute(scalar time) $sth->execute()
or $log->error("Couldn't finish transaction: " . $dbh->errstr); or $log->error("Couldn't finish transaction: " . $dbh->errstr);
if (!$sth->rows) { if (!$sth->rows) {
...@@ -41,12 +41,7 @@ sub exec { ...@@ -41,12 +41,7 @@ sub exec {
} }
while ($row = $sth->fetch) { while ($row = $sth->fetch) {
my (undef, undef, undef, $day, $month, $year, undef, undef, undef) = $msg = "[".$row->[0]."] ".$row->[1]." le ".$row->[2];
localtime($row->[2]);
$month++;
$year += 1900;
$msg = "[".$row->[0]."] ".$row->[1]." le $day/$month/$year";
$msg .= " @ ".$row->[3] if ($row->[3]); $msg .= " @ ".$row->[3] if ($row->[3]);
$msg .= " : ".$row->[4] if ($row->[4]); $msg .= " : ".$row->[4] if ($row->[4]);
$msg .= " <".$row->[5].">" if ($row->[5]); $msg .= " <".$row->[5].">" if ($row->[5]);
......
0% Chargement en cours ou .
You are about to add 0 people to the discussion. Proceed with caution.
Terminez d'abord l'édition de ce message.
Veuillez vous inscrire ou vous pour commenter