Last active
November 10, 2022 09:54
-
-
Save twysto/a9c8caf7a9a727814ec7bd3e3c4113b7 to your computer and use it in GitHub Desktop.
Time spent (Hours minutes seconds) using Carbon
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 // Run it at: https://web.tinkerwell.app | |
use Carbon\Carbon; | |
$datetime_start = Carbon::now()->subHours(1)->subMinutes(05)->subSeconds(42); | |
echo $datetime_start->format('Y-m-d H:i:s') . "\r\n"; | |
$datetime_end = Carbon::now(); | |
$timestamp_ms_end = $datetime_end->getTimestamp(); | |
echo $datetime_end->format('Y-m-d H:i:s') . "\r\n"; | |
echo $datetime_start->longAbsoluteDiffForHumans($datetime_end, 3); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment