CodeIgniter Forums
How to show total days from date - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Using CodeIgniter (https://forum.codeigniter.com/forumdisplay.php?fid=5)
+--- Forum: General Help (https://forum.codeigniter.com/forumdisplay.php?fid=24)
+--- Thread: How to show total days from date (/showthread.php?tid=91197)



How to show total days from date - Anharr - 07-01-2024

I have article function to post an article and I want to show total days after this article is posted. For Example : 
I posted article at 27 June 2024, today is 2 July 2024. In my article will show the information "6 Days Ago"

My type data for date posting is : 
Unix Timestamp (1719853709) it will show 1 July 2024

My question is : 


  1. How to show total hours after submit (1 hours ago, 5 hours ago, 23 hours ago) if the article posted under 24 hours
  2. How to show total date after submit (1 Days Ago, 2 Days Ago, 20 Days Ago, 29 Days Ago) if the article posted under 1 month
  3. How to show total month (1 month ago, 2 month ago, 10 month ago, 11 month ago) if the article posted under 1 years
  4. How to show total years (1 Years Ago) 


Master, please help. Thank you very much.


RE: How to show total days from date - kenjis - 07-01-2024

See https://codeigniter.com/user_guide/libraries/time.html#humanize


RE: How to show total days from date - Anharr - 07-02-2024

(07-01-2024, 11:24 PM)kenjis Wrote: See https://codeigniter.com/user_guide/libraries/time.html#humanize

Solved, Thank you