Keyword

[Solved] Date format to x days ago

  • Remus Ionita
  • Remus Ionita's Avatar Topic Author
  • Offline
  • Junior Member
More
13 years 5 months ago - 13 years 5 months ago #60587 by Remus Ionita
[Solved] Date format to x days ago was created by Remus Ionita
Hi,
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
  • Remus Ionita's Avatar Topic Author
  • Offline
  • Junior Member
More
13 years 5 months ago #60588 by Remus Ionita
Replied by Remus Ionita on topic Re: Date format to x days ago
Anyone?
I'm using Joomla 1.5.25 and K2 2.5.4

Please Log in or Create an account to join the conversation.

More
13 years 5 months ago - 13 years 5 months ago #60589 by jim
Replied by jim on topic Re: Date format to x days ago
Hi ,

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
  • Remus Ionita's Avatar Topic Author
  • Offline
  • Junior Member
More
13 years 5 months ago #60590 by Remus Ionita
Replied by Remus Ionita on topic Re: Date format to x days ago
:lol: good point...

Please Log in or Create an account to join the conversation.

  • Kannan Naidu Venugopal
  • Kannan Naidu Venugopal's Avatar
  • Offline
  • Platinum Member
  • Aham Brahmasmi
More
13 years 5 months ago - 13 years 5 months ago #60591 by Kannan Naidu Venugopal
Replied by Kannan Naidu Venugopal on topic Re: Date format to x days ago
Hi Remus,

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
  • Kannan Naidu Venugopal's Avatar
  • Offline
  • Platinum Member
  • Aham Brahmasmi
More
13 years 5 months ago #60592 by Kannan Naidu Venugopal
Replied by Kannan Naidu Venugopal on topic Re: Date format to x days ago
I just did a test, if you want to display the x day ago and time. Follow this guide, i'm sure there's a simpler way to do it in joomla.

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
  • Remus Ionita's Avatar Topic Author
  • Offline
  • Junior Member
More
13 years 5 months ago - 13 years 5 months ago #60593 by Remus Ionita
Replied by Remus Ionita on topic Re: Date format to x days ago
Hi,
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
  • Kannan Naidu Venugopal's Avatar
  • Offline
  • Platinum Member
  • Aham Brahmasmi
More
13 years 5 months ago #60594 by Kannan Naidu Venugopal
Replied by Kannan Naidu Venugopal on topic Re: Date format to x days ago
Hi Remus,

Did you get any error message ? Attached are the files.



K2 Rocks \m/
Attachments:

Please Log in or Create an account to join the conversation.

  • Remus Ionita
  • Remus Ionita's Avatar Topic Author
  • Offline
  • Junior Member
More
13 years 5 months ago - 13 years 5 months ago #60595 by Remus Ionita
Replied by Remus Ionita on topic Re: Date format to x days ago
Hi,
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
  • Kannan Naidu Venugopal's Avatar
  • Offline
  • Platinum Member
  • Aham Brahmasmi
More
13 years 5 months ago #60596 by Kannan Naidu Venugopal
Replied by Kannan Naidu Venugopal on topic Re: Date format to x days ago
Ok, i was testing it on Joomla 1.7.3

K2 Rocks \m/

Please Log in or Create an account to join the conversation.

  • Kannan Naidu Venugopal
  • Kannan Naidu Venugopal's Avatar
  • Offline
  • Platinum Member
  • Aham Brahmasmi
More
13 years 5 months ago #60597 by Kannan Naidu Venugopal
Replied by Kannan Naidu Venugopal on topic Re: Date format to x days ago
Can you share FTP access?

K2 Rocks \m/

Please Log in or Create an account to join the conversation.

  • Remus Ionita
  • Remus Ionita's Avatar Topic Author
  • Offline
  • Junior Member
More
13 years 5 months ago #60598 by Remus Ionita
Replied by Remus Ionita on topic Re: Date format to x days ago
Sure...what folder do you need acces to?

Please Log in or Create an account to join the conversation.

  • Kannan Naidu Venugopal
  • Kannan Naidu Venugopal's Avatar
  • Offline
  • Platinum Member
  • Aham Brahmasmi
More
13 years 5 months ago #60599 by Kannan Naidu Venugopal
Replied by Kannan Naidu Venugopal on topic Re: Date format to x days ago
components/com_k2

K2 Rocks \m/

Please Log in or Create an account to join the conversation.

  • Remus Ionita
  • Remus Ionita's Avatar Topic Author
  • Offline
  • Junior Member
More
13 years 5 months ago - 13 years 5 months ago #60600 by Remus Ionita
Replied by Remus Ionita on topic Re: Date format to x days ago
This email address is being protected from spambots. You need JavaScript enabled to view it.
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
  • Kannan Naidu Venugopal's Avatar
  • Offline
  • Platinum Member
  • Aham Brahmasmi
More
13 years 5 months ago #60601 by Kannan Naidu Venugopal
Replied by Kannan Naidu Venugopal on topic Re: Date format to x days ago
OK check your category date display now.

K2 Rocks \m/

Please Log in or Create an account to join the conversation.

  • Remus Ionita
  • Remus Ionita's Avatar Topic Author
  • Offline
  • Junior Member
More
13 years 5 months ago #60602 by Remus Ionita
Replied by Remus Ionita on topic Re: Date format to x days ago
It works...with a few glitches (if I add an articol now it shows me added 2 hours ago). But that not important now (I think now I can modify it myself to work). Thanks a lot!
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
  • Kannan Naidu Venugopal's Avatar
  • Offline
  • Platinum Member
  • Aham Brahmasmi
More
13 years 5 months ago #60603 by Kannan Naidu Venugopal
Replied by Kannan Naidu Venugopal on topic Re: Date format to x days ago
I remember reading a post in the old community forum, perhaps a google search might help :D... i got to go home now...LOL

K2 Rocks \m/

Please Log in or Create an account to join the conversation.

  • Remus Ionita
  • Remus Ionita's Avatar Topic Author
  • Offline
  • Junior Member
More
13 years 5 months ago #60604 by Remus Ionita
Replied by Remus Ionita on topic Re: Date format to x days ago
Ok. Thanks again. I hope I'll find that article...

Regards.

Please Log in or Create an account to join the conversation.

  • Remus Ionita
  • Remus Ionita's Avatar Topic Author
  • Offline
  • Junior Member
More
13 years 5 months ago #60605 by Remus Ionita
Replied by Remus Ionita on topic Re: Date format to x days ago
Searched all day but without luck. Can you help me with the problem or with the link to that article you've been mention about?
Thanks!

Please Log in or Create an account to join the conversation.

  • Kannan Naidu Venugopal
  • Kannan Naidu Venugopal's Avatar
  • Offline
  • Platinum Member
  • Aham Brahmasmi
More
13 years 5 months ago #60606 by Kannan Naidu Venugopal
Replied by Kannan Naidu Venugopal on topic Re: Date format to x days ago
Hi,

You can read a few suggestions and method from this thread .

K2 Rocks \m/

Please Log in or Create an account to join the conversation.


Powered by Kunena Forum