- Posts: 30
COMMUNITY FORUM
[Solved] Date format to x days ago
- Remus Ionita
-
Topic Author
- Offline
- Junior Member
First off all thank you for this amazing extension. Keep up the good work!
Secondly I'm using K2 on my site (here -> www.mtrailer.ro/pagina-de-teste/) and I would like to change the format of the date. Now it's like this DATE_FORMAT_LC2 (%A, %d %B %Y %H:%M) and I want to change it to added 2 days ago or 3 months ago or if it's from today, 10 hours, 16 minutes ago.
Do you have any ideas?
Thanks!
Regards.
Please Log in or Create an account to join the conversation.
- Remus Ionita
-
Topic Author
- Offline
- Junior Member
- Posts: 30
I'm using Joomla 1.5.25 and K2 2.5.4
Please Log in or Create an account to join the conversation.
- jim
-
- Offline
- New Member
- Posts: 2
I have no idea why this forum is actually running, i went into ask help and all i see are streaming links to football matches. :S , perhaps you should find a moderators post and reply to his and see if you can get some help like that, otherwise your thread gets bumped down and never to bee seen or replied. In other words this forum lacks so much professional help its amazing why its actually under a k2 banner. :angry:
Please Log in or Create an account to join the conversation.
- Remus Ionita
-
Topic Author
- Offline
- Junior Member
- Posts: 30
Please Log in or Create an account to join the conversation.
- Kannan Naidu Venugopal
-
- Offline
- Platinum Member
- Aham Brahmasmi
You can read some php documentation on date_diff and see some examples on how it's done. There is such feature in K2 Comments module where you can display the date as relative. To make it work in item view or category view requires some programming skills.
K2 Rocks \m/
Please Log in or Create an account to join the conversation.
- Kannan Naidu Venugopal
-
- Offline
- Platinum Member
- Aham Brahmasmi
Copy the php code found here and paste it into components/com_k2/views/item/view.html.php
Just remove the <?php ?> tags from the code.
Paste below this line (line 360)
K2 Rocks \m/
Please Log in or Create an account to join the conversation.
- Remus Ionita
-
Topic Author
- Offline
- Junior Member
- Posts: 30
Thanks Kannan Naidu for the reply.
Unfortunately it's not working....or I did something wrong..Can you please give me the files (view.html.php and item.php) that are working for you?
Thanks.
Regards.
Please Log in or Create an account to join the conversation.
- Kannan Naidu Venugopal
-
- Offline
- Platinum Member
- Aham Brahmasmi
K2 Rocks \m/
Please Log in or Create an account to join the conversation.
- Remus Ionita
-
Topic Author
- Offline
- Junior Member
- Posts: 30
No error message. Just not working. (as you can see here -> www.mtrailer.ro/pagina-de-teste/)
item.php -> components/com_k2/templates/default
view.html.php -> components/com_k2/views/item
Did I uploaded them in the wrong folder?
edit:
Now I see...
www.mtrailer.ro/pagina-de-teste/item/5-romania.html -> Warning: strtotime() expects parameter 1 to be string, object given in /home/rmtrai17/public_html/components/com_k2/views/item/view.html.php on line 243
future event
Also I don't want the date from the item...date from category_item....
Please Log in or Create an account to join the conversation.
- Kannan Naidu Venugopal
-
- Offline
- Platinum Member
- Aham Brahmasmi
K2 Rocks \m/
Please Log in or Create an account to join the conversation.
- Kannan Naidu Venugopal
-
- Offline
- Platinum Member
- Aham Brahmasmi
K2 Rocks \m/
Please Log in or Create an account to join the conversation.
- Remus Ionita
-
Topic Author
- Offline
- Junior Member
- Posts: 30
Please Log in or Create an account to join the conversation.
- Kannan Naidu Venugopal
-
- Offline
- Platinum Member
- Aham Brahmasmi
K2 Rocks \m/
Please Log in or Create an account to join the conversation.
- Remus Ionita
-
Topic Author
- Offline
- Junior Member
- Posts: 30
12kannan19
Also in category_intem I would like when clicked on the image or the title the articol to apear in a popup but only with some fields (video, fulltext and social buttons). Now it loads all the site...can you help me with that too? (if you can, know etc.)
Thanks.
Regards.
Please Log in or Create an account to join the conversation.
- Kannan Naidu Venugopal
-
- Offline
- Platinum Member
- Aham Brahmasmi
K2 Rocks \m/
Please Log in or Create an account to join the conversation.
- Remus Ionita
-
Topic Author
- Offline
- Junior Member
- Posts: 30
With my second problem you think you can help me?
Regards.
Please Log in or Create an account to join the conversation.
- Kannan Naidu Venugopal
-
- Offline
- Platinum Member
- Aham Brahmasmi
K2 Rocks \m/
Please Log in or Create an account to join the conversation.
- Remus Ionita
-
Topic Author
- Offline
- Junior Member
- Posts: 30
Regards.
Please Log in or Create an account to join the conversation.
- Remus Ionita
-
Topic Author
- Offline
- Junior Member
- Posts: 30
Thanks!
Please Log in or Create an account to join the conversation.
- Kannan Naidu Venugopal
-
- Offline
- Platinum Member
- Aham Brahmasmi
K2 Rocks \m/
Please Log in or Create an account to join the conversation.