Last active
August 29, 2015 14:25
-
-
Save Schlaefer/61ff394ef7f8929826cf to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// mysql queries | |
INSERT INTO `tests` (`stamp`) VALUES ('2015-07-01T00:00:00+0000'); | |
INSERT INTO `tests` (`stamp`) VALUES ('2015-07-01 00:00:00'); | |
INSERT INTO `tests` (`stamp`) VALUES ('2015-07-01T00:00:00+0400'); | |
INSERT INTO `tests` (`stamp`) VALUES ('2015-07-01 00:00:00'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
date_default_timezone_set('UTC'); | |
$table = TableRegistry::get('tests'); | |
$table->deleteAll(['id >' => '0']); | |
$entity = $table->newEntity( | |
[ | |
'stamp' => '2015-07-01T00:00:00+0000' | |
] | |
); | |
$table->save($entity); | |
$entity = $table->newEntity( | |
[ | |
'stamp' => new Time('2015-07-01T00:00:00+0000') | |
] | |
); | |
$table->save($entity); | |
$entity = $table->newEntity( | |
[ | |
'stamp' => '2015-07-01T00:00:00+0400' | |
] | |
); | |
$table->save($entity); | |
$entity = $table->newEntity( | |
[ | |
'stamp' => new Time('2015-07-01T00:00:00+0400') | |
] | |
); | |
$table->save($entity); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
CREATE TABLE `tests` ( | |
`id` int(11) unsigned NOT NULL AUTO_INCREMENT, | |
`stamp` datetime DEFAULT NULL, | |
PRIMARY KEY (`id`) | |
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
id stamp | |
70 2015-07-01 00:00:00 | |
71 2015-07-01 00:00:00 | |
72 2015-07-01 00:00:00 | |
73 2015-07-01 00:00:00 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment