Posting in the Magento forums has been disabled pending the implementation of a new and improved forum solution which should better serve the community.

For new questions please post at magento.stackexchange.com, the community-run support site for the Magento community. We will be providing updates on the new forum solution soon. For questions or concerns please email community@magento.com.

Magento Forum

Page 1 of 2
Order date is wrong when invoicing after upgrade to 1.1.8
 
turbo1
Sr. Member
 
Avatar
Total Posts:  296
Joined:  2008-08-19
Los Angeles, CA
 

I upgraded from 1.1.6 -> 1.1.8 last night. Everything appears to be fine, except one thing.  When I invoice a customer, the dates show up like this:

Order Date Dec 2, 2008 12:19:29 PM
Order Date (America/Los_Angeles) Feb 12, 2008 12:19:29 PM

The real order date is the top one, I have no idea where the second one is coming from. When printing a PDF invoice, it shows the proper date.  Anyone know where the second one is coming from?

 
Magento Community Magento Community
Magento Community
Magento Community
 
jpbazinet
Jr. Member
 
Total Posts:  9
Joined:  2008-10-14
 

Mine is doing this too… and I noticed that on Dec. 2 it said Feb. 12.
and on Dec. 4, it said April 12.

Obviously the order of numbers in the date is wrong…

 
Magento Community Magento Community
Magento Community
Magento Community
 
turbo1
Sr. Member
 
Avatar
Total Posts:  296
Joined:  2008-08-19
Los Angeles, CA
 

I initially thought that too, but I just got this:

Dec 4, 2008 4:36:31 PM
Order Date (America/Los_Angeles) May 11, 2008 5:36:31 PM

Now I’m completely stumped.

 
Magento Community Magento Community
Magento Community
Magento Community
 
hyteckit
Sr. Member
 
Avatar
Total Posts:  166
Joined:  2008-04-01
Los Angeles, CA
 

Haha… same here.  v1.1.8 is so broken.  I couldn’t even process credit cards.

 
Magento Community Magento Community
Magento Community
Magento Community
 
turbo1
Sr. Member
 
Avatar
Total Posts:  296
Joined:  2008-08-19
Los Angeles, CA
 

Yikes.. luckily I didn’t have that problem. That would suck :( And here I thought I was being smart by waiting after 1.1.7 came out.. I thought 1.1.8 was the ‘fixed’ version of .7.

And jpbazinet I think you are right with your theory after all - looking back at my second post, I see that it’s off exactly 1 digit in every field :

December 4 + 1 = May
11th + 1 = December
4:36pm + 1 = 5:36pm

WTF

 
Magento Community Magento Community
Magento Community
Magento Community
 
dakman
Member
 
Avatar
Total Posts:  38
Joined:  2008-07-09
 

Yes occurring here for a client on 1.1.8.. Anyone submit a bug report already?

 
Magento Community Magento Community
Magento Community
Magento Community
 
turbo1
Sr. Member
 
Avatar
Total Posts:  296
Joined:  2008-08-19
Los Angeles, CA
 

I haven’t submitted a bug yet - feel free to do so smile

 
Magento Community Magento Community
Magento Community
Magento Community
 
Scott_TriState
Member
 
Total Posts:  35
Joined:  2008-06-06
 

Thanks to turbo1 for seeing my post and bringing me to this thread. I don’t know how search didn’t pick this thread up. Anyway - I’ve been looking through the files in Adminhtml/Block/Sales/Order and I haven’t seen anything yet. Not sure if it’s something that changed in a file or if it’s in the DB now. I’m stumped for now but I’ll keep looking.

 
Magento Community Magento Community
Magento Community
Magento Community
 
Scott_TriState
Member
 
Total Posts:  35
Joined:  2008-06-06
 

Looks like a bug has been submitted:

http://www.magentocommerce.com/bug-tracking/issue?issue=4300

 
Magento Community Magento Community
Magento Community
Magento Community
 
joyously
Guru
 
Total Posts:  447
Joined:  2008-08-21
 

From reading that bug report and searching the code, it seems like several of the issues with 1.1.8 have this same date problem. Here’s what I found searching

Searching for: function formatDate
Mage\Core\Block\Abstract
.php(805): public function formatDate($date=null$format='short'$showTime=false)
Mage\Core\Helper\Data.php(87): public function formatDate($date=null$format='short'$showTime=false)
Mage\Core\Model\Resource\Abstract.php(96): public function formatDate($date$includeTime=true)
Mage\Eav\Model\Entity\Attribute\Backend\Datetime.php(44): public function formatDate($date)
Found 4 occurrence(sin 4 file(s)
It doesn’t make sense to me to define the same function more than once, and with different parameters (and default values!). Maybe it’s calling the wrong one.
Searching for: formatDate
Mage\Adminhtml\Block\Customer\Edit\Tab\Newsletter
.php(81): return $this->formatDate($subscriber->getChangeStatusAt(), Mage_Core_Model_Locale::FORMAT_TYPE_MEDIUMtrue);
Mage\Adminhtml\Block\Customer\Edit\Tab\View.php(133): return $this->formatDate($this->getCustomer()->getCreatedAt(), Mage_Core_Model_Locale::FORMAT_TYPE_MEDIUMtrue);
Mage\Adminhtml\Block\Customer\Edit\Tab\View.php(139): return $this->formatDate($dateMage_Core_Model_Locale::FORMAT_TYPE_MEDIUMtrue);
Mage\Adminhtml\Block\Customer\Edit\Tab\View.php(151): return $this->formatDate($dateMage_Core_Model_Locale::FORMAT_TYPE_MEDIUMtrue);
Mage\Adminhtml\Block\Customer\Edit\Tab\View.php(159): return $this->formatDate($dateMage_Core_Model_Locale::FORMAT_TYPE_MEDIUMtrue);
Mage\Adminhtml\Block\Dashboard\Graph.php(281): $this->_axisLabels[$idx][$_index] $this->formatDate($_label);
Mage\Adminhtml\Block\Sales\Order\View.php(147): $this->formatDate($this->getOrder()->getCreatedAt(), 'medium'true)
Mage\Adminhtml\Block\Sales\Order\View.php(152): $this->formatDate($this->getOrder()->getCreatedAt(), 'medium'true)
Mage\Adminhtml\Block\Sales\Order\View.php(158): $this->formatDate($this->getOrder()->getCreatedAt(), 'medium'true)
Mage\Adminhtml\Block\Sales\Order\Creditmemo\Create.php(81): $this->formatDate($this->getCreditmemo()->getOrder()->getCreatedAt(), 'medium'true),
Mage\Adminhtml\Block\Sales\Order\Creditmemo\View.php(107): $this->formatDate($this->getCreditmemo()->getCreatedAt(), 'medium'true),
Mage\Adminhtml\Block\Sales\Order\Invoice\Create.php(73): $this->formatDate($this->getInvoice()->getOrder()->getCreatedAt(), 'medium'true),
Mage\Adminhtml\Block\Sales\Order\Invoice\View.php(121): $this->formatDate($this->getInvoice()->getOrder()->getCreatedAt(), 'medium'true),
Mage\Catalog\Model\Resource\Eav\Mysql4\Product\Collection.php(534): $conditions .= "_price_rule.rule_date = '".$this->getResource()->formatDate($storeDatefalse)."' AND ";
Mage\CatalogRule\Model\Observer.php(73): $resource->applyAllRulesForDateRange($resource->formatDate(mktime(0,0,0)));
Mage\CatalogRule\Model\Mysql4\Rule.php(172): $cond $write->quoteInto('rule_date between ?'$this->formatDate($fromDate));
Mage\CatalogRule\Model\Mysql4\Rule.php(173): $cond $write->quoteInto($cond.' and ?'$this->formatDate($toDate));
Mage\CatalogRule\Model\Mysql4\Rule.php(513): $data['rule_date']          $this->formatDate($data['rule_date']false);
Mage\CatalogRule\Model\Mysql4\Rule.php(514): $data['latest_start_date']  $this->formatDate($data['latest_start_date']false);
Mage\CatalogRule\Model\Mysql4\Rule.php(515): $data['earliest_end_date']  $this->formatDate($data['earliest_end_date']false);
Mage\CatalogRule\Model\Mysql4\Rule.php(541): ->where('rule_date=?'$this->formatDate($datefalse))
Mage\CatalogRule\Model\Mysql4\Rule.php(561): ->where('rule_date=?'$this->formatDate($datefalse))
Mage\CatalogSearch\Model\Mysql4\Query.php(72): $object->setUpdatedAt($this->formatDate(Mage::getModel('core/date')->gmtTimestamp()));
Mage\Core\Block\Abstract.php(805): public function formatDate($date=null$format='short'$showTime=false)
Mage\Core\Block\Abstract.php(807): return $this->helper('core')->formatDate($date$format$showTime);
Mage\Core\Helper\Data.php(87): public function formatDate($date=null$format='short'$showTime=false)
Mage\Core\Model\Mysql4\Convert\History.php(44): $object->setPerformedAt($this->formatDate(time()));
Mage\Core\Model\Mysql4\Convert\Profile.php(44): $object->setCreatedAt($this->formatDate(time()));
Mage\Core\Model\Mysql4\Convert\Profile.php(46): $object->setUpdatedAt($this->formatDate(time()));
Mage\Core\Model\Resource\Abstract.php(96): public function formatDate($date$includeTime=true)
Mage\Dataflow\Model\Mysql4\Profile.php(44): $object->setCreatedAt($this->formatDate(time()));
Mage\Dataflow\Model\Mysql4\Profile.php(46): $object->setUpdatedAt($this->formatDate(time()));
Mage\Dataflow\Model\Mysql4\Profile\History.php(44): $object->setPerformedAt($this->formatDate(time()));
Mage\Eav\Model\Entity\Attribute\Backend\Datetime.php(31): $value $this->formatDate($object->getData($this->getAttribute()->getName()));
Mage\Eav\Model\Entity\Attribute\Backend\Datetime.php(44): public function formatDate($date)
Mage\Review\Block\View.php(98): return $this->formatDate($dateMage_Core_Model_Locale::FORMAT_TYPE_LONG);
Mage\Review\Block\Customer\List.php(90): return $this->formatDate($dateMage_Core_Model_Locale::FORMAT_TYPE_SHORT);
Mage\Review\Block\Customer\Recent.php(80): return $this->formatDate($dateMage_Core_Model_Locale::FORMAT_TYPE_SHORT);
Mage\Review\Block\Customer\View.php(103): return $this->formatDate($dateMage_Core_Model_Locale::FORMAT_TYPE_LONG);
Mage\Rss\Block\Catalog\New.php(68): $todayDate $product->getResource()->formatDate(time());
Mage\Rss\Block\Catalog\Salesrule.php(84): '<br/>Discount Start Date: '.$this->formatDate($sr->getFromDate(), 'medium').
Mage\Rss\Block\Catalog\Salesrule.php(85): ( $sr->getToDate() ? ('<br/>Discount End Date: '.$this->formatDate($sr->getToDate(), 'medium')):'').
Mage\Rss\Block\Catalog\Special.php(55): $todayDate $product->getResource()->formatDate(time());
Mage\Rss\Block\Catalog\Special.php(126): ($result['use_special'&& $result['special_to_date''<br/> Special Expires on: '.$this->formatDate($result['special_to_date']Mage_Core_Model_Locale::FORMAT_TYPE_MEDIUM) : '').
Mage\Rss\Block\Order\New.php(48): $passDate $order->getResource()->formatDate(mktime(0,0,0,date('m'),date('d')-7));
Mage\Rss\Block\Order\New.php(80): $title Mage::helper('rss')->__('Order #%s created at %s'$order->getIncrementId(), $this->formatDate($order->getCreatedAt()));
Mage\Rss\Block\Order\Status.php(71): Mage::helper('rss')->__('Notified Date: %s<br/>',$this->formatDate($result['created_at'])).
Mage\Rss\Block\Order\Status.php(84): $title Mage::helper('rss')->__('Order #%s created at %s'$order->getIncrementId(), $this->formatDate($order->getCreatedAt()));
Mage\Sales\Model\Order.php(1260): return Mage::getBlockSingleton('core/text')->formatDate($this->getCreatedAt(), $format);
Mage\Sales\Model\Order\Pdf\Abstract.php(183): $page->drawText(Mage::helper('sales')->__('Order Date: ') . Mage::helper('core')->formatDate($order->getCreatedAt(), 'medium'false), 35760'UTF-8');
Mage\Tag\Block\Customer\Recent.php(70): return $this->formatDate($dateMage_Core_Model_Locale::FORMAT_TYPE_SHORT);
Mage\Wishlist\Block\Customer\Wishlist.php(74): return $this->formatDate($dateMage_Core_Model_Locale::FORMAT_TYPE_MEDIUM);
Mage\Wishlist\Block\Share\Wishlist.php(97): return $this->formatDate($dateMage_Core_Model_Locale::FORMAT_TYPE_MEDIUM);
Mage\Wishlist\Block\Share\Email\Items.php(82): return $this->formatDate($dateMage_Core_Model_Locale::FORMAT_TYPE_MEDIUM);
Found 54 occurrence(sin 35 file(s)
But it seems like several of the 1.1.8 issues I’ve read about on the forum are listed here in this search (curious coincidence?).
 
Magento Community Magento Community
Magento Community
Magento Community
 
turbo1
Sr. Member
 
Avatar
Total Posts:  296
Joined:  2008-08-19
Los Angeles, CA
 

<sigh> When will a new version actually fix stuff instead of breaking it.

 
Magento Community Magento Community
Magento Community
Magento Community
 
pauljosephson
Member
 
Total Posts:  37
Joined:  2007-08-31
 

The two dates seemed to be one for the order admin date and the other for the store date.  They only show if one is different from the other.  This pure conjecture:  I assume it is differing between the two to show adjustment by the timezone of the server.  So if a person creates an order from the east coast and the server is on the West coast an edit it will show the two different times that the order took place.  I did not know what they were and the display does nothing explain the difference or why so I went edited the template file info.phtml file which this view is from adding an “ [admin]” & “[store]” to the date label and moving the timezone info below the actual time. This extra info is only shown when they are both displayed otherwise I leave it alone date label alone.  I thought about removing this extra date display because it was confusing a client but I thought it best to leave it in for now with the added text.

if you wish to remove the extra date just find the file app\design\adminhtml\default\default\template\sales\order\view\info.phtml and around line 50 comment out the section with the IF statement that compares the two dates.

Now if I can just get Magento to fix those date creation problems.  Among the annoyances is the comments that show dates a day after the actual close date or invoice date do not help my clients.  I have searched but have not seen any quick fixes for this.  This would be nice if someone from Magento were to put a fix for this online in the forums rather then cause countless headaches to developers.

Image Attachments
twodates-on-order.png
 
Magento Community Magento Community
Magento Community
Magento Community
 
bonhommie
Member
 
Total Posts:  60
Joined:  2008-06-02
 

I did not upgrade - I have been using 1.1.7 since it came out - but I have the same problem. Just started on the 1st. I think it was something to do with the turn of the new year.

 
Magento Community Magento Community
Magento Community
Magento Community
 
I Am Me
Jr. Member
 
Total Posts:  9
Joined:  2008-10-20
 

Maybe a leap year bug? 2008 was a leap year....

What’s going to happen after Jan 12th? Looks as if the month and day are mixed up on my install every date since the beginning of the year shows the first of each month (todays date is Aug 1 - yesterday’s was Jul 1) - well since there is no 13th month, is this going to break after the 12th?

 
Magento Community Magento Community
Magento Community
Magento Community
 
bitpopper
Jr. Member
 
Total Posts:  1
Joined:  2009-02-05
 

Any definition or resolution on these multiple order dates in 1.1.8 yet?

 
Magento Community Magento Community
Magento Community
Magento Community
 
stevensurowiec
Jr. Member
 
Total Posts:  15
Joined:  2008-06-23
 

I’ve just recently starting have issues related to this on 1.1.8 because we just launched and are just now getting orders at 9/10pm where bad timezone conversion causes them to appear on the wrong date. My “fix” to this was to modify the design/adminhtml/default/default/template/sales/order/view/info.phtml template to just display one of them at a time so as not to confuse the client, since the client honestly doesn’t care about this kind of thing. The following is a before and after:

Before

<tr>
  <
td class="label"><label><?php echo Mage::helper('sales')->__('Order Date'?></label></td>
  <
td><strong><?php echo $orderAdminDate ?></strong></td>
</
tr>
<?php if ($orderAdminDate != $orderStoreDate):?>
  
<tr>
    <
td class="label"><label><?php echo Mage::helper('sales')->__('Order Date (%s)'$_order->getCreatedAtDate()->getTimezone()) ?></label></td>
    <
td><strong><?php echo $orderStoreDate ?></strong></td>
  </
tr>
<?php endif;?>

After

<?php if ($orderAdminDate != $orderStoreDate):?>
  
<tr>
    <
td class="label"><label><?php echo Mage::helper('sales')->__('Order Date'?></label></td>
    <
td><strong><?php echo $orderStoreDate ?></strong></td>
  </
tr>
<?php else: ?>
  
<tr>
    <
td class="label"><label><?php echo Mage::helper('sales')->__('Order Date'?></label></td>
    <
td><strong><?php echo $orderAdminDate ?></strong></td>
  </
tr>
<?php endif;?>

Another issue I had is that entries under the ‘Comments History’ were displaying the wrong date. So for an order placed May 12, 2009 10:33:00 PM the first entry under comments history that gets created at time of order said May 13, 2009 10:33:00 PM. I tracked this down and it looks like the formatDate() function in the core helper (app/code/core/Mage/Core/Helper/Data.php) doesn’t perform a timezone offset. Below is a before and after of a section of this function I changed for this. I should point out that you probably don’t want to modify the actual core file but instead create app/code/local/Mage/Core/Helper/Data.php as a copy of the one in core and then make the changes to that one instead.

Before

elseif (!$date instanceof Zend_Date{
  $date 
Mage::app()->getLocale()->date(strtotime($date), nullnull$showTime);
}

After

elseif (!$date instanceof Zend_Date{
  $date 
Mage::app()->getLocale()->date(strtotime($date), nullnull$showTime);
  
$date->add(Mage::getModel('core/date')->getGmtOffset());
}

I’m still investigating this because there’s reports of other issues else where, I’ll post more updates as I have them. I was hoping a simple upgrade to a newer version of Magento would help but there’s a lot of custom code so an upgrade won’t be so simple and Magento seems to become less and less stable with each new version so to be honest I’m kind of scared to even consider an upgrade of a live site.

 
Magento Community Magento Community
Magento Community
Magento Community
Magento Community
Magento Community
Back to top
Page 1 of 2