Skip to content

Instantly share code, notes, and snippets.

@marcghorayeb
Created May 25, 2012 14:26
Show Gist options
  • Save marcghorayeb/2788415 to your computer and use it in GitHub Desktop.
Save marcghorayeb/2788415 to your computer and use it in GitHub Desktop.
Lithium timestamp fix
<?php
case 'timestamp':
if ($value === 'CURRENT_TIMESTAMP') {
return 'NULL';
} else if (is_numeric($value)) {
return $this->connection->quote(date('Y-m-d H:i:s', $value));
} else if (is_string($value)) {
return $this->connection->quote(date('Y-m-d H:i:s', strtotime($value)));
} else {
throw new InvalidArgumentException('given value for date is invalid');
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment