PHP code example of kilofox / ephemeris

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

    

kilofox / ephemeris example snippets


use Kilofox\Ephemeris\Calendar;

$calendar = new Calendar;

// 阳历转阴历
$result = $calendar->solar2lunar(2021, 3, 19);

// 阴历转阳历
$result = $calendar->lunar2solar(2021, 2, 7);


array (
  'lunar_year' => 2021,
  'lunar_month' => 2,
  'lunar_day' => 7,
  'lunar_year_chinese' => '二零二一',
  'lunar_month_chinese' => '二月',
  'lunar_day_chinese' => '初七',
  'cstb_year' => '辛丑',
  'cstb_month' => '辛卯',
  'cstb_day' => '丙寅',
  'is_leap' => true,
)

array (
  'solar_year' => 2021,
  'solar_month' => 3,
  'solar_day' => 19,
  'solar_hour' => 18,
  'solar_minute' => 21,
  'solar_second' => 7,
)