Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9117445
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T04:53:51+00:00 2026-06-17T04:53:51+00:00

I have the following column in a grid: $this->addColumn(‘order_date’, array( ‘header’=> $this->__(‘Date’), ‘align’ =>’left’,

  • 0

I have the following column in a grid:

        $this->addColumn('order_date',
        array(
            'header'=> $this->__('Date'),
            'align' =>'left',
            'width' => '100px',
            'index' => 'order_date',
            'type' => 'date',
            'filter_index' => 'orders_alias.created_at'
        )
    );

Example data looks like this: http://imageshack.us/photo/my-images/502/scr028.jpg/

When filtering on date 13 Oct 2012 no rows are found. This makes sense because it is a timestamp column. http://imageshack.us/photo/my-images/29/scr029.jpg/

How can I do this to use the Magento date from/to selector and select 13/10/2012 and show all rows
with this date regardless of the time part?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-17T04:53:53+00:00Added an answer on June 17, 2026 at 4:53 am

    This a bug that only shows up when you are trying to show a value as date and database column is datetime or timestamp.

    It happens because date is changed to YYYY-MM-DD HH:MM:SS and HH:MM:SS being 00:00:00 for date from and to. The date to should be set to 23:59:59.

    One way to do this would be to change the code in app/code/core/Mage/Adminhtml/Block/Widget/Grid/Column/Filter/Date.php to support this. In setValue function just change

    EDIT: This first solution would require changes in Datetime.php getValue (removing code that adds one day and removes one second) as well and because you shouldn’t change core code the second solution would definitely be the preferred one.

    $value['to'] = $this->_convertDate($value['to'], $value['locale']);
    

    to

    $value['to'] = $this->_convertDate($value['to'], $value['locale'])->addDay(1)->subSecond(1);
    

    Since this changes the functionality of all the filters a better solution would be to change your local code:

    $this->addColumn('order_date',
        array(
            'header'=> $this->__('Date'),
            'align' =>'left',
            'width' => '100px',
            'index' => 'order_date',
            'type' => 'datetime',
            'filter_index' => 'orders_alias.created_at',
            'frame_callback' => array( $this,'styleDate' )
        )
    // ...
    
    public function styleDate( $value,$row,$column,$isExport )
    {
      $locale = Mage::app()->getLocale();
      $date = $locale->date( $value, $locale->getDateFormat(), $locale->getLocaleCode(), false )->toString( $locale->getDateFormat() ) ;
      return $date;
    }
    

    This will remove time part from being shown in the grid’s fields but will let you use filters the way you described above.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have the following in my webgrid: grid.Column(header: Action, format: delegate(dynamic i) { return
I have the following 2 column div layout. The left column needs to have
I have the following simpl WPf grid, two columns, a button in each column,
I have been following this nice walkthrough for creating a grid using MVC contrib.
I have the following issue when using KendoUI Grid with a column template: My
I have the following XAML inside a 4 Row by 2 column grid. The
I have the following case:: Before: one Grid view ,,this grid view has two
I have the following code where the image is higher than 44px: <div style=width:300px;display:-ms-grid;-ms-grid-rows:44px
I have the following code in a partial view; <%= Html.Grid(Model).Columns(column => { column.For(model
I have the following grid of data: ---------Header 1 Header 2 Header 3 Header

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.