Created
December 13, 2024 14:36
-
-
Save ziadoz/03a8804a12598bf93ca726961af68bf8 to your computer and use it in GitHub Desktop.
Carbon - Diff in minutes/hours/days
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
> \Carbon\Carbon::now()->subMinutes(60)->longAbsoluteDiffForHumans(); | |
= "1 hour" | |
> \Carbon\Carbon::now()->subMinutes(1440)->longAbsoluteDiffForHumans(); | |
= "1 day" | |
> \Carbon\Carbon::now()->subMinutes(1560)->longAbsoluteDiffForHumans(); | |
= "1 day" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment