Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Making the Dates Easier to Read


jonesevan007

Recommended Posts

Hey guys,

 

Been editing the admin order module (admin/includes/modules/index/orders.php) and have really had fun changing stuff around.

 

I successfully changed this:

Old osc orders style (sorted by date last modified)

Customer Name | Total | Date Last Modified | Status

 

to this:

New style (sorted by order#)

Customer Name | # | Total | Date Purchased | Status

 

but now I request help changing the date_purchased format from 2008-12-31 06:22:35 to 12/31/08 6:22am on the admin homepage (which draws from the orders module)

 

is there a way to massage the database output to format a date differently?

 

might it have something to do with date()? thanks for the counsel!

 

----------------------------------------------------------------------------------------------------

for those interested in the changes I've made to the sorting of orders, here's the source of my admin/includes/modules/index/orders.php

<table border="0" width="100%" cellspacing="0" cellpadding="4">
 <tr class="dataTableHeadingRow">
<td class="dataTableHeadingContent">Order</td>
<td class="dataTableHeadingContent">   #</td>
<td class="dataTableHeadingContent">  Total</td>
<td class="dataTableHeadingContent">Date Purchased</td>
<td class="dataTableHeadingContent">Status</td>
 </tr>
<?php
 $orders_query = tep_db_query("select o.orders_id, o.customers_name, o.date_purchased, greatest(o.date_purchased, ifnull(o.last_modified, 0)) as date_last_modified, s.orders_status_name, ot.text as order_total from " . TABLE_ORDERS . " o, " . TABLE_ORDERS_TOTAL . " ot, " . TABLE_ORDERS_STATUS . " s where o.orders_id = ot.orders_id and ot.class = 'ot_total' and o.orders_status = s.orders_status_id and s.language_id = '" . (int)$languages_id . "' order by orders_id desc limit 30");
 while ($orders = tep_db_fetch_array($orders_query)) {
echo '  <tr class="dataTableRow" onmouseover="rowOverEffect(this);" onmouseout="rowOutEffect(this);">' .
	 '	<td class="dataTableContent"><a href="' . tep_href_link(FILENAME_ORDERS, 'oID=' . (int)$orders['orders_id'] . '&action=edit') . '">' . tep_output_string_protected($orders['customers_name']) . '</td>' .
	 '	<td class="dataTableContent">' . $orders['orders_id'] . '</td>' .
	 '	<td class="dataTableContent">' . strip_tags($orders['order_total']) . '</td>' .
	 '	<td class="dataTableContent">' . $orders['date_purchased'] . '</td>' .
	 '	<td class="dataTableContent">' . $orders['orders_status_name'] . '</td>' .
	 '  </tr>';
 }
?>
</table>

Link to comment
Share on other sites

For this line:

 

		 '	<td class="dataTableContent">' . $orders['date_purchased'] . '</td>' .

Try:

 

		 '	<td class="dataTableContent">' . strftime( "%m/%d/%y %I:%M%P" , strtotime($orders['date_purchased'] ) ) . '</td>' .

BACKUP FIRST!

If I suggest you edit any file(s) make a backup first - I'm not perfect and neither are you.

 

"Given enough impetus a parallelogramatically shaped projectile can egress a circular orifice."

- Me -

 

"Headers already sent" - The definitive help

 

"Cannot redeclare ..." - How to find/fix it

 

SSL Implementation Help

 

Like this post? "Like" it again over there >

Link to comment
Share on other sites

For another place you can change the date format go to /includes/languages/english.php

 

Then you can use the functions to format dates.

 

Enjoy

Need help installing add ons/contributions, cleaning a hacked site or a bespoke development, check my profile

 

Virus Threat Scanner

My Contributions

Basic install answers.

Click here for Contributions / Add Ons.

UK your site.

Site Move.

Basic design info.

 

For links mentioned in old answers that are no longer here follow this link Useful Threads.

 

If this post was useful, click the Like This button over there ======>>>>>.

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...