PHP code example of bekim2121 / ethiopian-datepicker

1. Go to this page and download the library: Download bekim2121/ethiopian-datepicker 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/ */

    

bekim2121 / ethiopian-datepicker example snippets



EthiopianDatePicker\EthiopianDatePicker;

// Get current Ethiopian date
$today = EthiopianDatePicker::today();
echo "Today: " . EthiopianDatePicker::formatDate($today, 'amharic', 'long') . "\n";

// Convert Gregorian to Ethiopian
$ethiopianDate = EthiopianDatePicker::gregorianToEthiopian(2023, 9, 11);
echo "Ethiopian date: " . EthiopianDatePicker::formatDate($ethiopianDate, 'english', 'long') . "\n";

// Convert Ethiopian to Gregorian
$gregorianDate = EthiopianDatePicker::ethiopianToGregorian(2016, 1, 1);
echo "Gregorian date: " . implode('-', $gregorianDate) . "\n";


thiopianDatePicker\EthiopianDatePicker;

// All methods are static - no instantiation needed
$today = EthiopianDatePicker::today();

// Format options
$date = [2016, 1, 1];

// Different language formats
echo EthiopianDatePicker::formatDate($date, 'amharic', 'long');  // "1 መስከረም 2016"
echo EthiopianDatePicker::formatDate($date, 'english', 'long');  // "1 Meskerem 2016"
echo EthiopianDatePicker::formatDate($date, 'amharic', 'short'); // "2016-1-1"
echo EthiopianDatePicker::formatDate($date, 'english', 'short'); // "2016-1-1"

// Get month names
$amharicMonths = EthiopianDatePicker::getAmharicMonths();
$englishMonths = EthiopianDatePicker::getEnglishMonths();
javascript
new EthiopianTimePicker('#input', {
  useEthiopianTime: true, // Native 12h cycle (Sunrise = 12:00)
  twelveHour: true,       // Day/Night labels (ረፋድ, ማታ, etc.)
  darkMode: false,
  onChange: (time) => console.log(time.ethiopian.formatted)
});