This repository has been archived by the owner on Oct 16, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 0ac183d
Showing
47 changed files
with
10,408 additions
and
0 deletions.
There are no files selected for viewing
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,83 @@ | ||
Java Chinese Calendar | ||
================================= | ||
|
||
# Introduction | ||
|
||
**Java Chinese Calendar** is a Java library of Chinese (lunar) calendar. It can convert date between Gregorian calendar(also called Western calendar) and Chinese calendar. Also, it can compute the weight of Ba Zi(八字). | ||
|
||
# Usage | ||
|
||
A large part of the code about **Java Chinese Calendar** is written in Chinese. | ||
|
||
## 農曆 Class | ||
|
||
**農曆** class is in the *org.magiclen.農曆* package. | ||
|
||
### Initialize | ||
|
||
You can't create a **農曆** instance by using **new** operator directly. You have to use the **建立** static method provided by **農曆** class to create a **農曆** instance. | ||
|
||
You can pass the year, month and the days of the month in Gregorian calendar as parameters to **建立** method. | ||
|
||
For example, we want to create a **農曆** object instance with the date 2015-12-16 in Gregorian calendar. The code will be, | ||
|
||
農曆.建立(2015, 12, 12); | ||
|
||
For example, we want to create a **農曆** object instance with the date 2015-12-16 in Chinese calendar and we know that date is not in a leap month. The code will be, | ||
|
||
農曆 date = 農曆.建立(2015, 12, false, 12); | ||
|
||
### Get the date in Gregorian calendar | ||
|
||
Use **取得西曆** method to get the date in Gregorian calendar. | ||
|
||
String gregorianDate = date.取得西曆(); | ||
|
||
### Get the date in Chinese calendar | ||
|
||
Use **取得農曆** method to get the date in Chinese calendar. | ||
|
||
String chineseDate = date.取得農曆(); | ||
|
||
### Compute the weight of Ba Zi(八字) | ||
|
||
Use **計算八字有幾兩重** method to compute the weight of Ba Zi. Because **農曆** object has no hour information, if you want to compute the weight of Ba Zi, you have to provide the hour information in the form of the twelve Earthly Branches. | ||
|
||
float BaZiWeight = date.計算八字有幾兩重(農曆.地支.子); | ||
|
||
# Run **Java Chinese Calendar** as a program | ||
|
||
You can also use the two commands below to run **Java Chinese Calendar**: | ||
|
||
java -jar JavaChineseCalendar.jar | ||
|
||
It will show today's date in Gregorian calendar and Chinese calendar. The result just likes | ||
|
||
西曆:2015-12-16 | ||
農曆:2015(乙未、羊年) 冬月 初六 | ||
|
||
You can input a date in Gregorian calendar. This program can convert it to the date in Chinese calendar. | ||
|
||
java -jar JavaChineseCalendar.jar YYYY MM DD | ||
|
||
# License | ||
|
||
Copyright 2015-2016 magiclen.org | ||
|
||
Licensed under the Apache License, Version 2.0 (the "License"); | ||
you may not use this file except in compliance with the License. | ||
You may obtain a copy of the License at | ||
|
||
http://www.apache.org/licenses/LICENSE-2.0 | ||
|
||
Unless required by applicable law or agreed to in writing, software | ||
distributed under the License is distributed on an "AS IS" BASIS, | ||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
See the License for the specific language governing permissions and | ||
limitations under the License. | ||
|
||
# What's More? | ||
|
||
Please check out our web page at | ||
|
||
https://magiclen.org/java-chinese-calendar/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> | ||
<!-- NewPage --> | ||
<html lang="zh"> | ||
<head> | ||
<!-- Generated by javadoc (1.8.0_72) on Sat Mar 12 15:09:25 CST 2016 --> | ||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> | ||
<title>All Classes</title> | ||
<meta name="date" content="2016-03-12"> | ||
<link rel="stylesheet" type="text/css" href="stylesheet.css" title="Style"> | ||
<script type="text/javascript" src="script.js"></script> | ||
</head> | ||
<body> | ||
<h1 class="bar">All Classes</h1> | ||
<div class="indexContainer"> | ||
<ul> | ||
<li><a href="org/magiclen/%E8%BE%B2%E6%9B%86/%E7%89%88%E6%9C%AC.html" title="class in org.magiclen.農曆" target="classFrame">版本</a></li> | ||
<li><a href="org/magiclen/%E8%BE%B2%E6%9B%86/%E8%BE%B2%E6%9B%86.html" title="class in org.magiclen.農曆" target="classFrame">農曆</a></li> | ||
<li><a href="org/magiclen/%E8%BE%B2%E6%9B%86/%E8%BE%B2%E6%9B%86.%E5%9C%B0%E6%94%AF.html" title="enum in org.magiclen.農曆" target="classFrame">農曆.地支</a></li> | ||
<li><a href="org/magiclen/%E8%BE%B2%E6%9B%86/%E8%BE%B2%E6%9B%86.%E5%A4%A9%E5%B9%B2.html" title="enum in org.magiclen.農曆" target="classFrame">農曆.天干</a></li> | ||
<li><a href="org/magiclen/%E8%BE%B2%E6%9B%86/%E8%BE%B2%E6%9B%86.%E6%97%A5.html" title="enum in org.magiclen.農曆" target="classFrame">農曆.日</a></li> | ||
<li><a href="org/magiclen/%E8%BE%B2%E6%9B%86/%E8%BE%B2%E6%9B%86.%E6%9C%88.html" title="enum in org.magiclen.農曆" target="classFrame">農曆.月</a></li> | ||
<li><a href="org/magiclen/%E8%BE%B2%E6%9B%86/%E8%BE%B2%E6%9B%86.%E7%94%9F%E8%82%96.html" title="enum in org.magiclen.農曆" target="classFrame">農曆.生肖</a></li> | ||
</ul> | ||
</div> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> | ||
<!-- NewPage --> | ||
<html lang="zh"> | ||
<head> | ||
<!-- Generated by javadoc (1.8.0_72) on Sat Mar 12 15:09:25 CST 2016 --> | ||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> | ||
<title>All Classes</title> | ||
<meta name="date" content="2016-03-12"> | ||
<link rel="stylesheet" type="text/css" href="stylesheet.css" title="Style"> | ||
<script type="text/javascript" src="script.js"></script> | ||
</head> | ||
<body> | ||
<h1 class="bar">All Classes</h1> | ||
<div class="indexContainer"> | ||
<ul> | ||
<li><a href="org/magiclen/%E8%BE%B2%E6%9B%86/%E7%89%88%E6%9C%AC.html" title="class in org.magiclen.農曆">版本</a></li> | ||
<li><a href="org/magiclen/%E8%BE%B2%E6%9B%86/%E8%BE%B2%E6%9B%86.html" title="class in org.magiclen.農曆">農曆</a></li> | ||
<li><a href="org/magiclen/%E8%BE%B2%E6%9B%86/%E8%BE%B2%E6%9B%86.%E5%9C%B0%E6%94%AF.html" title="enum in org.magiclen.農曆">農曆.地支</a></li> | ||
<li><a href="org/magiclen/%E8%BE%B2%E6%9B%86/%E8%BE%B2%E6%9B%86.%E5%A4%A9%E5%B9%B2.html" title="enum in org.magiclen.農曆">農曆.天干</a></li> | ||
<li><a href="org/magiclen/%E8%BE%B2%E6%9B%86/%E8%BE%B2%E6%9B%86.%E6%97%A5.html" title="enum in org.magiclen.農曆">農曆.日</a></li> | ||
<li><a href="org/magiclen/%E8%BE%B2%E6%9B%86/%E8%BE%B2%E6%9B%86.%E6%9C%88.html" title="enum in org.magiclen.農曆">農曆.月</a></li> | ||
<li><a href="org/magiclen/%E8%BE%B2%E6%9B%86/%E8%BE%B2%E6%9B%86.%E7%94%9F%E8%82%96.html" title="enum in org.magiclen.農曆">農曆.生肖</a></li> | ||
</ul> | ||
</div> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,166 @@ | ||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> | ||
<!-- NewPage --> | ||
<html lang="zh"> | ||
<head> | ||
<!-- Generated by javadoc (1.8.0_72) on Sat Mar 12 15:09:25 CST 2016 --> | ||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> | ||
<title>Constant Field Values</title> | ||
<meta name="date" content="2016-03-12"> | ||
<link rel="stylesheet" type="text/css" href="stylesheet.css" title="Style"> | ||
<script type="text/javascript" src="script.js"></script> | ||
</head> | ||
<body> | ||
<script type="text/javascript"><!-- | ||
try { | ||
if (location.href.indexOf('is-external=true') == -1) { | ||
parent.document.title="Constant Field Values"; | ||
} | ||
} | ||
catch(err) { | ||
} | ||
//--> | ||
</script> | ||
<noscript> | ||
<div>JavaScript is disabled on your browser.</div> | ||
</noscript> | ||
<!-- ========= START OF TOP NAVBAR ======= --> | ||
<div class="topNav"><a name="navbar.top"> | ||
<!-- --> | ||
</a> | ||
<div class="skipNav"><a href="#skip.navbar.top" title="Skip navigation links">Skip navigation links</a></div> | ||
<a name="navbar.top.firstrow"> | ||
<!-- --> | ||
</a> | ||
<ul class="navList" title="Navigation"> | ||
<li><a href="org/magiclen/%E8%BE%B2%E6%9B%86/package-summary.html">Package</a></li> | ||
<li>Class</li> | ||
<li>Use</li> | ||
<li><a href="overview-tree.html">Tree</a></li> | ||
<li><a href="deprecated-list.html">Deprecated</a></li> | ||
<li><a href="index-files/index-1.html">Index</a></li> | ||
<li><a href="help-doc.html">Help</a></li> | ||
</ul> | ||
</div> | ||
<div class="subNav"> | ||
<ul class="navList"> | ||
<li>Prev</li> | ||
<li>Next</li> | ||
</ul> | ||
<ul class="navList"> | ||
<li><a href="index.html?constant-values.html" target="_top">Frames</a></li> | ||
<li><a href="constant-values.html" target="_top">No Frames</a></li> | ||
</ul> | ||
<ul class="navList" id="allclasses_navbar_top"> | ||
<li><a href="allclasses-noframe.html">All Classes</a></li> | ||
</ul> | ||
<div> | ||
<script type="text/javascript"><!-- | ||
allClassesLink = document.getElementById("allclasses_navbar_top"); | ||
if(window==top) { | ||
allClassesLink.style.display = "block"; | ||
} | ||
else { | ||
allClassesLink.style.display = "none"; | ||
} | ||
//--> | ||
</script> | ||
</div> | ||
<a name="skip.navbar.top"> | ||
<!-- --> | ||
</a></div> | ||
<!-- ========= END OF TOP NAVBAR ========= --> | ||
<div class="header"> | ||
<h1 title="Constant Field Values" class="title">Constant Field Values</h1> | ||
<h2 title="Contents">Contents</h2> | ||
<ul> | ||
<li><a href="#org.magiclen">org.magiclen.*</a></li> | ||
</ul> | ||
</div> | ||
<div class="constantValuesContainer"><a name="org.magiclen"> | ||
<!-- --> | ||
</a> | ||
<h2 title="org.magiclen">org.magiclen.*</h2> | ||
<ul class="blockList"> | ||
<li class="blockList"> | ||
<table class="constantsSummary" border="0" cellpadding="3" cellspacing="0" summary="Constant Field Values table, listing constant fields, and values"> | ||
<caption><span>org.magiclen.農曆.<a href="org/magiclen/%E8%BE%B2%E6%9B%86/%E7%89%88%E6%9C%AC.html" title="class in org.magiclen.農曆">版本</a></span><span class="tabEnd"> </span></caption> | ||
<tr> | ||
<th class="colFirst" scope="col">Modifier and Type</th> | ||
<th scope="col">Constant Field</th> | ||
<th class="colLast" scope="col">Value</th> | ||
</tr> | ||
<tbody> | ||
<tr class="altColor"> | ||
<td class="colFirst"><a name="org.magiclen.農曆.版本.MAINTENANCE"> | ||
<!-- --> | ||
</a><code>public static final int</code></td> | ||
<td><code><a href="org/magiclen/%E8%BE%B2%E6%9B%86/%E7%89%88%E6%9C%AC.html#MAINTENANCE">MAINTENANCE</a></code></td> | ||
<td class="colLast"><code>1</code></td> | ||
</tr> | ||
<tr class="rowColor"> | ||
<td class="colFirst"><a name="org.magiclen.農曆.版本.MAJOR"> | ||
<!-- --> | ||
</a><code>public static final int</code></td> | ||
<td><code><a href="org/magiclen/%E8%BE%B2%E6%9B%86/%E7%89%88%E6%9C%AC.html#MAJOR">MAJOR</a></code></td> | ||
<td class="colLast"><code>2</code></td> | ||
</tr> | ||
<tr class="altColor"> | ||
<td class="colFirst"><a name="org.magiclen.農曆.版本.MINOR"> | ||
<!-- --> | ||
</a><code>public static final int</code></td> | ||
<td><code><a href="org/magiclen/%E8%BE%B2%E6%9B%86/%E7%89%88%E6%9C%AC.html#MINOR">MINOR</a></code></td> | ||
<td class="colLast"><code>1</code></td> | ||
</tr> | ||
</tbody> | ||
</table> | ||
</li> | ||
</ul> | ||
</div> | ||
<!-- ======= START OF BOTTOM NAVBAR ====== --> | ||
<div class="bottomNav"><a name="navbar.bottom"> | ||
<!-- --> | ||
</a> | ||
<div class="skipNav"><a href="#skip.navbar.bottom" title="Skip navigation links">Skip navigation links</a></div> | ||
<a name="navbar.bottom.firstrow"> | ||
<!-- --> | ||
</a> | ||
<ul class="navList" title="Navigation"> | ||
<li><a href="org/magiclen/%E8%BE%B2%E6%9B%86/package-summary.html">Package</a></li> | ||
<li>Class</li> | ||
<li>Use</li> | ||
<li><a href="overview-tree.html">Tree</a></li> | ||
<li><a href="deprecated-list.html">Deprecated</a></li> | ||
<li><a href="index-files/index-1.html">Index</a></li> | ||
<li><a href="help-doc.html">Help</a></li> | ||
</ul> | ||
</div> | ||
<div class="subNav"> | ||
<ul class="navList"> | ||
<li>Prev</li> | ||
<li>Next</li> | ||
</ul> | ||
<ul class="navList"> | ||
<li><a href="index.html?constant-values.html" target="_top">Frames</a></li> | ||
<li><a href="constant-values.html" target="_top">No Frames</a></li> | ||
</ul> | ||
<ul class="navList" id="allclasses_navbar_bottom"> | ||
<li><a href="allclasses-noframe.html">All Classes</a></li> | ||
</ul> | ||
<div> | ||
<script type="text/javascript"><!-- | ||
allClassesLink = document.getElementById("allclasses_navbar_bottom"); | ||
if(window==top) { | ||
allClassesLink.style.display = "block"; | ||
} | ||
else { | ||
allClassesLink.style.display = "none"; | ||
} | ||
//--> | ||
</script> | ||
</div> | ||
<a name="skip.navbar.bottom"> | ||
<!-- --> | ||
</a></div> | ||
<!-- ======== END OF BOTTOM NAVBAR ======= --> | ||
</body> | ||
</html> |
Oops, something went wrong.