Created
December 4, 2023 03:27
-
-
Save lomotech/76eb2d2ecb7893e6cb526bbf09ec5dd3 to your computer and use it in GitHub Desktop.
Dapatkan tarikh hari ini jika bulan tersebut di panjangkan
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 | |
use Carbon\Carbon; | |
$targetDate = '2023-08'; | |
$today = Carbon::parse(); | |
$target = Carbon::createFromFormat('Y-m', $targetDate)->endOfMonth(); | |
$diff = $target->diffInDays($today); | |
echo 'Today: ' . $target->format('Y-m-') . ($target->format('d') + $diff); // at 2023-12-04 is 2023-08-125 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment