mardi 31 octobre 2017

Laravel 5 if statement between Carbon diffForHumans and toFormattedDatesString

I want to write an if statement to show timestamp in diffForHumans format for timestamps less than less than 5 days old and in toFormattedDatesString for anything older than that.

For example today is 31/10/17, so timestamp for 28/10/2017 should show - 3 days ago and timestamp for 20/10/2017 should show Oct 20, 2017.

Can someone please tell any logic to achieve this? Thanks in advance for the help.



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire