PHPackages                             namtenten/japan-nengo - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. namtenten/japan-nengo

ActiveLibrary

namtenten/japan-nengo
=====================

日本の年号

1.0.2(6y ago)017MITPHPPHP ^7.2

Since Nov 7Pushed 5y ago1 watchersCompare

[ Source](https://github.com/namtenten/JapanNengo)[ Packagist](https://packagist.org/packages/namtenten/japan-nengo)[ RSS](/packages/namtenten-japan-nengo/feed)WikiDiscussions master Synced yesterday

READMEChangelog (1)DependenciesVersions (4)Used By (0)

[![Donate](https://camo.githubusercontent.com/604e3db9c8751116b3f765aad0353ec7ded655bbe8aaacbc38d8c4a6b784b3ed/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f446f6e6174652d50617950616c2d677265656e2e737667)](https://www.paypal.me/rakujin)

JapanNengo / 年号
===============

[](#japannengo--年号)

- Convert Western Calendar to Japan Calendar. 西暦を和暦に変換
- Convert Japan Calendar to Western Calendar. 和暦を西暦に変換

E.g: 西暦を和暦に変換

- 1989/01/02 ⇒ 昭和64年01月02日
- 2019/04/30 ⇒ 平成31年04月30日
- 2019/05/01 ⇒ 令和1年05月01日

E.g: 和暦を西暦に変換

- 昭和64年01月02日 ⇒ 1989/01/02
- 平成31年04月30日 ⇒ 2019/04/30
- 令和1年05月01日 ⇒ 2019/05/01

Installation
============

[](#installation)

Composer
--------

[](#composer)

```
composer require namtenten/japan-nengo
```

Usage
=====

[](#usage)

Functions
---------

[](#functions)

### Convert Western Calendar to Japan Calendar. 西暦を和暦に変換

[](#convert-western-calendar-to-japan-calendar西暦を和暦に変換)

Function nameDescription`toNengoArray`return an array stores all information: year, month, day, nengo, start date of a nengo, end date of a nengo, etc.`toNengoYear`return a string stores only nengo year (和暦の年) of input （西暦）`toNengoDate`return a string stores full nengo date of input date### Convert Japan Calendar to Western Calendar. 和暦を西暦に変換

[](#convert-japan-calendar-to-western-calendar和暦を西暦に変換)

Function nameDescription`toDateArray`return an array stores all information: year, month, day, nengo, start date of a nengo, end date of a nengo, etc.`toYear`return a string stores only year (西暦) of input （和暦）`toDate`return a string stores full date of input date （和暦）Example:
--------

[](#example)

Test file:

```
# ./test/index.php

```

Example code (when using composer):

```
