PHP Classes

File: README.md

Recommend this page to a friend!
  Classes of Peter Kahl   Chinese Lunar Calendar   README.md   Download  
File: README.md
Role: Documentation
Content type: text/markdown
Description: Documentation
Class: Chinese Lunar Calendar
Convert Gregorian date to Chinese lunisolar
Author: By
Last change: Updated composer.json
Date: 5 years ago
Size: 1,409 bytes
 

Contents

Class file image Download

Chinese Lunar Calendar

Downloads Download per Month License If this project has business value for you then don't hesitate to support me with a small donation.

Converts from Gregorian date to Chinese lunisolar date and vice versa. Accepts dates between the years 1900-2100.

Usage

use peterkahl\Lunar\Lunar;

$gregorianDate = '2017-08-23';

$chineseDate = Lunar::Gregorian2Lunar($gregorianDate);

/*
array(7) {
  ["y"]=>
  int(2017)
  ["m"]=>
  int(7)
  ["d"]=>
  int(2)
  ["leap"]=>
  bool(false)
  ["zh-cn"]=>
  string(12) "????"
  ["zh-hk"]=>
  string(12) "????"
  ["ja"]=>
  string(12) "????"
  ["en"]=>
  string(5) "07-02"
}
*/
#-------------------------------------------------

$chineseDate = '2017-07-2';

$gregorianDate = Lunar::Lunar2Gregorian($chineseDate);

var_dump($gregorianDate);

/*
array(3) {
  ["y"]=>
  int(2017)
  ["m"]=>
  int(8)
  ["d"]=>
  int(23)
}
*/