Created
January 4, 2016 15:05
-
-
Save mpchadwick/fd789c4f88b9b707f3fb to your computer and use it in GitHub Desktop.
zend-date-issue
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 | |
// Replace this with whatever you need to initialize Magento | |
// this is really only needed to be able to instantiate a `Zend_Date` object | |
require_once('/var/www/html/app/Mage.php'); | |
Mage::app(); | |
$createdAt = '2016-01-03 05:01:24'; | |
$timezone = 'America/New_York'; | |
$date = new Zend_Date(strtotime($createdAt), null, 'en_US'); | |
$date->setTimezone($timezone); | |
$date->setHour(0)->setMinute(0)->setSecond(0); | |
echo $date->get('YYYY-MM-dd') . PHP_EOL; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Result: 2015-01-03