Use DateTime object instead of fixed format date string.

Use a DateTime object and have conversion handled by Doctrine instead of using
a date string with a fixed format.
This commit is contained in:
Andreas Fischer 2013-11-26 12:00:31 +01:00
parent 9fb1da2811
commit a330b2ef9b
1 changed files with 1 additions and 2 deletions

View File

@ -823,10 +823,9 @@ class Share {
$date = null;
} else {
$date = new \DateTime($date);
$date = date('Y-m-d H:i', $date->format('U') - $date->getOffset());
}
$query = \OC_DB::prepare('UPDATE `*PREFIX*share` SET `expiration` = ? WHERE `id` = ?');
$query->bindValue(1, $date);
$query->bindValue(1, $date, 'datetime');
foreach ($items as $item) {
$query->bindValue(2, (int) $item['id']);
$query->execute();