I'm using the "https://aladhan.com/islamic-calendar-api" in my PHP/Laravel application
Here is my code
public static function DateToHijri($gregorianDate)
{
$gregorianDate = '2024-12-03'; // the input
$dateFormat = date('d-m-Y', strtotime($gregorianDate));
$date = Http::get('http://api.aladhan.com/v1/gToH/' . $dateFormat)->json();
dd($gregorianDate, $date);
}
the result
"2024-12-03" // app\Models\Day.php:54
array:3 [▼ // app\Models\Day.php:54
"code" => 200
"status" => "OK"
"data" => array:2 [▼
"hijri" => array:8 [▼
"date" => "01-06-1446" // NOT 01 IT 02
"format" => "DD-MM-YYYY"
"day" => "01" // NOT 01 IT 02
"weekday" => array:2 [▼
"en" => "Al Thalaata"
"ar" => "الثلاثاء"
]
"month" => array:3 [▶]
"year" => "1446"
"designation" => array:2 [▶]
"holidays" => []
]
"gregorian" => array:7 [▶]
]
]
Check the reference I used to check the date
https://www.ummulqura.org.sa/yearcalender.aspx?y=1446&l=True