Zen Cart Logo
Forums / Templates, Stylesheets, Page Layout / How to show time in dates?

How to show time in dates?

Views: 740

Results 1 to 8 of 8
26 Aug 2011, 2:05 AM
#1
hubert avatar

hubert

Zen Follower

Join Date:
Mar 2005
Posts:
229
Plugin Contributions:
0

How to show time in dates?

Hello,

Long time ago I made a custom functions_email.php. This is great but now I need to show the time in the orders date.

I found the place where it is, in my line 516 I find :
zen_date_long($order_check->fields['date_purchased'])

the result in the mail is "Thursday 25 August, 2011"

I'd like it to be "Thursday 25 August, 2011, 15:16:17"

If I go to see date_purchased in phpMyAfmin I see that the time is here in the date_purchased field but I don't know how to get it.

What do I need to modify to get this in this file and only in this file ?
Do I need to replace zen_date_long by another function ? If so which one ?
Do I need to build a custom function so that the time is shown only in this case (if so I really need help) ?

Thanks for reading and your help.

Regards

Hubert

26 Aug 2011, 2:12 AM
#2
ajeh avatar

ajeh

Oba-san

Join Date:
Sep 2003
Location:
Ohio
Posts:
62,757
Plugin Contributions:
1

Re: How to show time in dates?

Customize the format on the define:

/admin/includes/languages/english.php

Line #22 : define('DATE_FORMAT_LONG', '%A %d %B, %Y'); // this is used for strftime() 

to suite your specific needs ...

28 Aug 2011, 7:42 PM
#3
hubert avatar

hubert

Zen Follower

Join Date:
Mar 2005
Posts:
229
Plugin Contributions:
0

Re: How to show time in dates?

Thanks for the answer,

I've changed
define('DATE_FORMAT_LONG', '%A %d %B, %Y'); // this is used for strftime()

with

define('DATE_FORMAT_LONG', '%A %d %B, %Y H:i:s'); // this is used for strftime()

and that doesn't do the trick.

The output is still : Saturday 27 August, 2011

Hubert

28 Aug 2011, 7:58 PM
#4
ajeh avatar

ajeh

Oba-san

Join Date:
Sep 2003
Location:
Ohio
Posts:
62,757
Plugin Contributions:
1

Re: How to show time in dates?

Try this:

/admin/includes/languages/english.php

Line #25 : define('DATE_FORMAT_LONG', '%A %d %B, %Y %H:%M:%S'); // this is used for strftime()

29 Aug 2011, 11:08 PM
#5
hubert avatar

hubert

Zen Follower

Join Date:
Mar 2005
Posts:
229
Plugin Contributions:
0

Re: How to show time in dates?

Hmmm... That's still not the solution.

To be complete here is my mod in fuction_email.php

$order_check = $db->Execute("select orders_id, cc_cvv, customers_name, customers_company, customers_street_address,
                                    customers_suburb, customers_city, customers_postcode,
                                    customers_state, customers_country, customers_telephone,
                                    customers_email_address, customers_address_format_id, delivery_name,
                                    delivery_company, delivery_street_address, delivery_suburb,
                                    delivery_city, delivery_postcode, delivery_state, delivery_country,
                                    delivery_address_format_id, billing_name, billing_company,
                                    billing_street_address, billing_suburb, billing_city, billing_postcode,
                                    billing_state, billing_country, billing_address_format_id,
                                    payment_method, cc_type, cc_owner, cc_number, cc_expires, currency,
                                    currency_value, date_purchased, orders_status, last_modified, shipping_method
                             from " . TABLE_ORDERS . "
                             where orders_id = '" . (int)$MyoID . "'");
.
.
.
 $Emb_Order_Extra = '<table border="0" cellspacing="0" cellpadding="2"  width="275"><tr><td class="main"><strong>' .  ENTRY_DATE_PURCHASED .  '</strong></td></tr><tr><td class="main">' .  zen_date_long($order_check->fields['date_purchased']) .  '</td></tr><tr><td class="main">' .  '<b>Customer comments: </b><br>' . $orders_history->fields['comments'] .  '</td></tr><tr><td class="main"><b>' .  ENTRY_PAYMENT_METHOD .  '</b></td></tr><tr><td class="main">' .  $order->info['payment_method'] .  '</td></tr></table>';

As far as I see the function is "zen_date_long($order_check->fields['date_purchased'])"

I don't understand why the modifications doesn't modify anything, it's as if it wasn't the good english.php file.... ???

I'm puzzled..

Thanks again for your help

Hubert

29 Aug 2011, 11:20 PM
#6
ajeh avatar

ajeh

Oba-san

Join Date:
Sep 2003
Location:
Ohio
Posts:
62,757
Plugin Contributions:
1

Re: How to show time in dates?

Not sure what to tell you about your custom code in the function ...

I know that change in the admin english.php will make the orders display with both date and time that you can see when you edit the order ...

Date Purchased: Monday 29 August, 2011 23:15:07
Payment Method: Check/Money Order

You will need to see if you are not modifying the function file correctly ...

30 Aug 2011, 12:32 AM
#7
ajeh avatar

ajeh

Oba-san

Join Date:
Sep 2003
Location:
Ohio
Posts:
62,757
Plugin Contributions:
1

Re: How to show time in dates?

NOTE: if your function is for the Catalog, you need to also edit the Catalog english.php file ...
/includes/languages/english.php

1 Sep 2011, 12:49 AM
#8
hubert avatar

hubert

Zen Follower

Join Date:
Mar 2005
Posts:
229
Plugin Contributions:
0

Re: How to show time in dates?

As far as I only want to modify the format for my mod and nowhere else, can I write something like that in my custom functions_email.php ?

define('DATE_FORMAT_LONG', '%A %d %B, %Y %T');
 $Emb_Order_Extra = '<table border="0" cellspacing="0" cellpadding="2"  width="275"><tr><td class="main"><strong>' .  ENTRY_DATE_PURCHASED .  '</strong></td></tr><tr><td class="main">' .  zen_date_long($order_check->fields['date_purchased']) .  '</td></tr><tr><td class="main">' .  '<b>Customer comments: </b><br>' . $orders_history->fields['comments'] .  '</td></tr><tr><td class="main"><b>' .  ENTRY_PAYMENT_METHOD .  '</b></td></tr><tr><td class="main">' .  $order->info['payment_method'] .  '</td></tr></table>';
define('DATE_FORMAT_LONG', '%A %d %B, %Y');

i.e. changing the format temporarly and then redefining it as it was before.

Hubert