alvinalexander.com | career | drupal | java | mac | mysql | perl | scala | uml | unix  

Java example source code file (cal_buddhist.xml)

This example Java source code file (cal_buddhist.xml) is included in the alvinalexander.com "Java Source Code Warehouse" project. The intent of this project is to help you "Learn Java by Example" TM.

Learn more about this Java project at its project page.

Java - Java tags/keywords

buddhist, buddhistchronology, calendar, datetime, gregorian, joda-time, sun, thai, thailand, the, this, wikipedia

The cal_buddhist.xml Java example source code

<?xml version="1.0" encoding="ISO-8859-1"?>

<document>

 <properties>
  <title>Java date and time API - Buddhist calendar system
  <author>Stephen Colebourne
 </properties>

 <body>

<section name="Buddhist calendar system">
<p>
The Buddhist calendar system implemented in Joda-Time is based on that supplied
in the private Sun packages of a typical JDK.
It differs from the <a href="cal_gj.html">GregorianJulian calendar only in the
year and era.
The Buddhist calendar has one era (the current era), and has a year offset by 543
from the current Gregorian year.
</p>
<p>
It appears that Sun developed the Buddhist Calendar system to meet the needs of Thailand.
However, the calendar is only accurate from 1941-01-01 (ISO).
Before that date Thailand used three other calendar systems.
The BuddhistChronology follows the design of the BuddhistCalendar.
It is hoped that in the future an accurate Thai chronology can be developed.
</p>
<p>
References
<ul>
<li>Wikipedia - Thai Solar Calendar
<li>Wikipedia - Thai Lunar Calendar
<li>Thai Calendar FAQs
</ul>
</p>
</section>

<section name="Using Buddhist chronology in Joda-Time">
<p>
Within Joda-Time the Buddhist calendar system can be used by obtaining an
instance of <a href="apidocs/org/joda/time/chrono/BuddhistChronology.html">BuddhistChronology.
This is normally created using the factory method
<a href="apidocs/org/joda/time/chrono/BuddhistChronology.html#getInstance()">BuddhistChronology.getInstance().
This is then passed into the constructors of the main date and time classes.
</p>
<source>
// setup date object for midday on May Day 2004 (ISO year 2004)
DateTime dtISO = new DateTime(2004, 5, 1, 12, 0, 0, 0);

// find out what the same instant is using the Buddhist Chronology
DateTime dtBudd = dtISO.withChronology(BuddhistChronology.getInstance());
</source>

</section>

</body>
</document>

Other Java examples (source code examples)

Here is a short list of links related to this Java cal_buddhist.xml source code file:

... this post is sponsored by my books ...

#1 New Release!

FP Best Seller

 

new blog posts

 

Copyright 1998-2024 Alvin Alexander, alvinalexander.com
All Rights Reserved.

A percentage of advertising revenue from
pages under the /java/jwarehouse URI on this website is
paid back to open source projects.