PHP code example of callmeahmedr / urdu-date-time-library

1. Go to this page and download the library: Download callmeahmedr/urdu-date-time-library 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/ */

    

callmeahmedr / urdu-date-time-library example snippets




rduDateLibrary\UrduDate;

$urduDate = new UrduDate();

// Hijri Conversion
$gregorianDate = '2024-09-07';
echo "Hijri Conversion for $gregorianDate: " . $urduDate->convertToHijri($gregorianDate) . "<br>";

// Islamic Event
$hijriDate = '12-10'; // Example Hijri date format
echo "Islamic Event for Hijri Date $hijriDate: " . $urduDate->getIslamicEvent($hijriDate) . "<br>";

// Date Difference
$date1 = '2024-09-01';
$date2 = '2024-09-07';
echo "Date Difference between $date1 and $date2: " . $urduDate->getDateDifference($date1, $date2) . "<br>";

// Time Formatting
$time = '14:30';
echo "Formatted Time in Urdu for $time: " . $urduDate->formatTimeInUrdu($time) . "<br>";

// Relative Time
$pastDate = '2024-09-06';
echo "Relative Time for $pastDate: " . $urduDate->relativeTime($pastDate) . "<br>";

// Urdu Month/Day Name
echo "Urdu Month/Day Name for Gregorian Date $gregorianDate: " . $urduDate->getUrduMonthDayName($gregorianDate) . "<br>";