PHP code example of kindy / hijridate
1. Go to this page and download the library: Download kindy/hijridate library . Choose the download type require .
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
kindy / hijridate example snippets
public HijriDateTime::__construct(
string $time = "now",
DateTimeZone $timezone = null,
string $langcode = null,
Kindy\HijriDate\Calendar $calendar = null
)
public function format(string $format): string
public function format(string $format): string
HijriDateTime::Date('_Y-_m-_d','2024-12-3');
use Kindy\HijriDate\HijriDateTime;
echo (new HijriDateTime())->format('_j _M _Yهـ');
// Output: 8 شعبان 1436هـ
echo (new HijriDateTime())->format('D _j _M _Yهـ (j-m-Yم)');
// Output: الثلاثاء 8 شعبان 1436هـ (26-05-2015م)
echo (new HijriDateTime("2015-5-22"))->format('D _j _M _Yهـ (j-m-Yم)');
// Output: الجمعة 4 شعبان 1436هـ (22-05-2015م)
use Kindy\HijriDate\HijriDateTime;
$hijirDate = HijriDateTime::createFromHijri(1436, 9, 1);
echo $hijirDate->format('D _j _M _Yهـ (j-m-Yم)');
// Output: الخميس 1 رمضان 1436هـ (18-06-2015م)
use Kindy\HijriDate\Calendar;
echo (new Calendar())->days_in_month(9, 1436);
// Output: 29
use Kindy\HijriDate\HijriDateTime as DateTime;
function hdate($format, $timestamp = null)
{
if (!isset($timestamp)) {
$timestamp = time();
}
$d = new HijriDateTime('@' . $timestamp);
return $d->format($format);
}