1. Go to this page and download the library: Download natilosir/jalali 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/ */
natilosir / jalali example snippets
use natilosir\jalali\time;
// Set timezone offset (e.g., Iran Standard Time)
time::Timezone(3.5);
// Define a Gregorian timestamp
$timestamp = time();
// Format the Jalali date
$formattedDate = time::format($timestamp, 'W D M Y h:i:s');
// OR
$formattedDate = time::format('W D M Y h:i:s');
// Output: یکشنبه بیستوپنجم آذر 1403 06:33:36
echo $formattedDate;
$timestamp = strtotime('2024-12-15 06:33:36');
$formattedDate = time::format($timestamp, 'W D M Y h:i:s');
// OR
$formattedDate = time::format('W D M Y h:i:s');
// Output: یکشنبه بیستوپنجم آذر 1403 06:33:36
echo $formattedDate;