Home > OS >  Laravel - Convert mysql datetime to ago format
Laravel - Convert mysql datetime to ago format

Time:09-22

I have a posts table in the database, and the table contains datetime row.

I want to convert the datetime to ago format like facebook does.

Thanks in advance.

CodePudding user response:

You can use the diffForHumans(); method, in the blade view file. for example:

$post->datetime->diffForHumans();

I hope it works!

  • Related