-2
I’m using the : briannesbitt/Carbon
I use this code to render what I wish
<?= \Carbon\Carbon::create($mail->created_at)->locale('pt')->diffForHumans(); ?> atrás
The same prints equal to the image below:
What I wish is the following: After 24 hours the email arrives in the inbox, the same print the creation date instead of "1 day ago" or "1 week ago" in case the "1 hour ago" is correct, and what is stated "1 week ago", should be the creation date example 17/02/2021.
Makes a
if
. If it is less than 24 hours, you show thediffForHumans
, otherwise shows the formatted date.– Woss
Thanks, boy I’m new with dates, I’m learning, now that I found out about Carbon.
– Daniel Alves