Page 1 of 1

Another silly date question.

Posted: Mon Jun 24, 2024 4:33 pm
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.

Re: Another silly date question.

Posted: Mon Jun 24, 2024 4:49 pm
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);

Re: Another silly date question.

Posted: Mon Jun 24, 2024 5:21 pm
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.