Post by samwise » Wed Sep 14, 2011 8:56 pm

Hi all,

I would like to display the time the order was placed next to the date, in the Sales->Orders page in the admin section.
Is there already a variable for time that I can call?

Cheers,
Sam

Newbie

Posts

Joined
Wed Sep 14, 2011 6:54 pm

Post by uksitebuilder » Thu Sep 15, 2011 7:13 pm

open: admin/controller/sale/order.php

find:

Code: Select all

'date_added'    => date($this->language->get('date_format_short'), strtotime($result['date_added'])),
change to:

Code: Select all

'date_added'    => date($this->language->get('date_format_short'), strtotime($result['date_added'])).' '.date($this->language->get('time_format'), strtotime($result['date_added'])),

User avatar
Guru Member

Posts

Joined
Thu Jun 09, 2011 11:37 pm
Location - United Kindgom

Post by joy » Sun Oct 16, 2011 12:59 pm

uksitebuilder wrote:open: admin/controller/sale/order.php

find:

Code: Select all

'date_added'    => date($this->language->get('date_format_short'), strtotime($result['date_added'])),
......
Kudos to you!

However, my server time and my local time is having a 15 hours difference. How can I make it to show the time in my local timezone?

I read the post about Setting Local Timezone values in database. I am not sure if I get the meaning wrong but I do not want to change the time in the MySQL database (what if I decided to change the host, and the server is at another time zone again, and that will mess up the time recorded... btw, i haven't check if the database recorded the time in unix timestamp).
I just want to have the local time display on the webpage, which probably is as stated in this post.

Someone did this, and I read this blog post too regarding the changes needed to show the local date for specials and discounts feature.

I don't know which approach is the best. Probably you can give suggestions and solutions on this if it is not too much of works.

Thank you in advance.

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

Edit to add:
Never mind, I decided to use the method showing in Setting Local Timezone values in database.
Last edited by joy on Mon Oct 17, 2011 10:21 pm, edited 1 time in total.

OC version 1.5.1.3


joy
New member

Posts

Joined
Fri Oct 14, 2011 9:18 am

Post by markman-b » Sun Oct 16, 2011 5:20 pm

uksitebuilder wrote:open: admin/controller/sale/order.php
change to:

Code: Select all

'date_added'    => date($this->language->get('date_format_short'), strtotime($result['date_added'])).' '.date($this->language->get('time_format'), strtotime($result['date_added'])),
Thanx, useful modification!
How does the string look like for an 24 hour notation?

OC version 1.5.4.1


Active Member

Posts

Joined
Wed Aug 24, 2011 7:13 pm

Post by joy » Mon Oct 17, 2011 10:12 pm

markman-b wrote: How does the string look like for an 24 hour notation?
You can change the format at admin/language/english/english.php
e.g. From h:i:s A = 08:05:13 PM to H:i:s = 20:05:13

change:

Code: Select all

$_['time_format']           = 'h:i:s A';
to:

Code: Select all

$_['time_format']           = 'H:i:s';

OC version 1.5.1.3


joy
New member

Posts

Joined
Fri Oct 14, 2011 9:18 am

Post by markman-b » Tue Oct 18, 2011 8:04 pm

Thanx joy!

OC version 1.5.4.1


Active Member

Posts

Joined
Wed Aug 24, 2011 7:13 pm

Post by markman-b » Tue Oct 18, 2011 9:39 pm

Hi guys,

Changing the the time format in the admin language files, does not convert the time into a 24 hour format.
It still shows the time in an 12 hour format, but without AM/PM.

Image


I assume this modification had to be done in the admin/conroller/sale/order.php file, isn't it?
Please tell me how.

kind regards
Markman-B

OC version 1.5.4.1


Active Member

Posts

Joined
Wed Aug 24, 2011 7:13 pm

Post by joy » Tue Oct 18, 2011 9:49 pm

markman-b wrote: It still shows the time in an 12 hour format, but without AM/PM.
Are you sure you typed "H"?
Because H is for 00~23, h is for 01~12. Please refer to the manual here.

This post here is another approach of changing the date & time format wherever you want.
Last edited by joy on Tue Oct 18, 2011 9:58 pm, edited 1 time in total.

OC version 1.5.1.3


joy
New member

Posts

Joined
Fri Oct 14, 2011 9:18 am

Post by markman-b » Tue Oct 18, 2011 9:56 pm

That capital H did the trick! I completely overlooked it.
Thnx mate.

OC version 1.5.4.1


Active Member

Posts

Joined
Wed Aug 24, 2011 7:13 pm

Post by joy » Tue Oct 18, 2011 9:59 pm

You are welcome! :)

OC version 1.5.1.3


joy
New member

Posts

Joined
Fri Oct 14, 2011 9:18 am

User avatar
New member

Posts

Joined
Tue Jul 05, 2011 3:53 pm


Post by jannoi » Fri Nov 18, 2011 6:52 pm

Hello guys,
This was really useful for my shop.
But is there a way to show the time also in the Dashboard?

Newbie

Posts

Joined
Fri Nov 18, 2011 6:51 pm

Post by olstar » Tue Nov 29, 2011 12:02 am

Do the same edit on the file used to show the dash :)

Professional UK Based eCommerce - Our Free Opencart Mods - Our Premium Opencart Mods
Kashflow Integration


User avatar
New member

Posts

Joined
Tue Jul 05, 2011 3:53 pm


Post by MvQ » Wed Dec 28, 2011 10:11 pm

THANKS! I really love this forum. SOOOO helpful!!
Worked like a charm..

MvQ
Newbie

Posts

Joined
Sat Dec 10, 2011 5:38 pm

Post by mmkvn » Tue Jan 03, 2012 6:06 pm

Thank you for the useful modification.

However, I have an issue related to time: By default, from the control panel in admin we can only set period by choosing a starting date and an ending date from a calendar drop-down (e.g: special discount period). How can I input a date WITH TIME (for example: 2011-12-13 10:06:49) in the control panel? This is important for my shop.

Thanks in advance

Newbie

Posts

Joined
Fri Dec 09, 2011 7:11 pm

Post by Ozfarmer » Tue Apr 24, 2012 5:00 pm

Thanks UK Brilliant!

Active Member

Posts

Joined
Wed Aug 17, 2011 7:08 pm
Location - Australia

Post by MikeSCC » Fri Mar 22, 2013 6:27 pm

Thanks for this.

Active Member

Posts

Joined
Tue Nov 20, 2012 5:55 pm

Post by venkatesh1993 » Sun Jan 26, 2014 10:51 pm

This works great, but how do I add the time on the Print Page ?
I tried to add the same time code, but it shows 00:00

Newbie

Posts

Joined
Fri Jan 03, 2014 4:05 am

Post by venkatesh1993 » Tue Jan 28, 2014 12:04 am

Anyone please ?

Newbie

Posts

Joined
Fri Jan 03, 2014 4:05 am

Post by nvedia » Tue Jan 28, 2014 12:13 am

venkatesh1993 wrote:This works great, but how do I add the time on the Print Page ?
I tried to add the same time code, but it shows 00:00
What do you mean by Print Page?
Print Order?
Which file did you try to edit?

Donate here to show support if you think I have helped you today!

Opencart Documentation


User avatar
Active Member

Posts

Joined
Sun May 22, 2011 12:54 pm
Who is online

Users browsing this forum: No registered users and 38 guests