Another silly date question.

Open to all! Ask other shopowners for help.
Post Reply
14Steve14
Senior Contributor
Posts: 923
Joined: Fri Oct 25, 2019 7:01 pm
Phoenix Version: v1.0.9.1
Has thanked: 17 times
Been thanked: 103 times

Another silly date question.

Post by 14Steve14 »

I need a bit of help adding the time next to the date in the orders table so it shows the date and time of when an order was placed.

In admin/includes/actions/orders/views/default.php I can find the code as below

Code: Select all

[
        'name' => TABLE_HEADING_DATE_PURCHASED,
        'class' => 'text-right',
        'function' => function (&$row) {
          return Date::abridge($row['date_purchased']);
        },
      ],
and looking at other similar types of areas where the time is shown I know I need to add a variation of

Code: Select all

$contents[] = ['text' => sprintf(TEXT_DATE_ORDER_CREATED, (new Date($table_definition['info']->date_purchased))->format(DATE_TIME_FORMAT))];
I have tried all sorts of things and keep getting blank pages and error.

can someone help with this so the date shows in the orders table please.


Join The Code Co-op to get access to your library in the Code Co-op Forum
ecartz
Core Team
Posts: 3084
Joined: Tue Nov 05, 2019 6:02 pm
Phoenix Version:
Has thanked: 4 times
Been thanked: 208 times

Re: Another silly date question.

Post by ecartz »

If you are on a version where the second variation works, then

Code: Select all

          return (new Date($row['date_purchased']))->format(DATE_TIME_FORMAT);
14Steve14
Senior Contributor
Posts: 923
Joined: Fri Oct 25, 2019 7:01 pm
Phoenix Version: v1.0.9.1
Has thanked: 17 times
Been thanked: 103 times

Re: Another silly date question.

Post by 14Steve14 »

@ecartz Many thanks. I think I tried nearly every combination of that code that I could try but nothing worked. Thanks for the help.


Join The Code Co-op to get access to your library in the Code Co-op Forum
Post Reply