
DateTime::Format::Japanese::Traditional - A Japanese DateTime Formatter For Traditional Japanese Calendar

use DateTime::Format::Japanese::Traditional;
my $fmt = DateTime::Format::Japanese::Traditional->new();
# or if you want to set options,
my $fmt = DateTime::Format::Japanese::Traditional->new(
number_format => FORMAT_KANJI,
month_format => FORMAT_WAREKI_MONTH,
with_traditional_marker => 1
);
my $str = $fmt->format_datetime($dt);
my $dt = $fmt->parse_datetime("大åä¸å¹´å¼¥ç䏿¥ä¸ä¸ã¤å»");

This module implements a DateTime::Format module that can read tradtional Japanese date notations and create a DateTime::Calendar::Japanese object, and vice versa.
XXX WARNING WARNING WARNING XXX Currently DateTime::Format::Japanese only supports Perl 5.7 and up. This is because I'm ignorant in the ways of making robust regular expressions in Perls <= 5.6.x with Jcode. If anybody can contribute to this, I would much appreciate it XXX WARNING WARNING WARNING XXX

This constructor will create a DateTime::Format::Japanese object. You may optionally pass any of the following parameters:
number_format - how to format numbers (default: FORMAT_KANJI) month_format - how to format months (default: FORMAT_NUMERIC_MONTH) with_traditional_marker - use traditional calendar marker (default: 0)
Please note that all of the above parameters only take effect for formatting, and not parsing. Parsing is done in a way such that it accepts any of the known formats that this module can produce.
This function will parse a traditional Japanese date/time string and convert it to a DateTime::Calendar::Japanese object. If the parsing is unsuccessful it will croak. Note that it will try to auto-detect whatever encoding you're using via Encode::Guess, so you should be safe to pass any of UTF-8, euc-jp, shift-jis, and iso-2022-jp encoded strings.
This method can be called as a class function as well.
my $dt = DateTime::Format::Japanese::Traditional->parse_datetime($string); # or my $fmt = DateTime::Format::Japanese::Traditional->new(); my $fmt->parse_daettime($string);

All of the following methods accept a single parameter, a DateTime::Calendar::Japanese object, and return the appropriate string representation.
my $dt = DateTime->now(); my $fmt = DateTime::Format::Japanese::Traditional->new(...); my $str = $fmt->format_datetime($dt);
Create a complete string representation of a DateTime::Calendar::Japanese object in Japanese
Create a string representation of year, month, and date of a DateTime object in Japanese
Create a string representation of the year of a DateTime::Calendar::Japanese object in Japanese
Create a string representation of the month of a DateTime::Calendar::Japanese object in Japanese
Create a string representation of the day (day of month) of a DateTime::Calendar::Japanese object in Japanese
Create a string representation of the time (hour, minute, second) of a DateTime::Calendar::Japanese object in Japanese

Get/Set the encoding that this module should expect to use.
Get/Set the number formatting option. Possible values are:
Formats the numbers in plain ascii roman numerals.
Formats numbers in kanji numerals without any unit specifiers.
Formats numbers in zenkaku numerals (double-byte equivalent of roman numerals)
Formats numbers in kanji numerals, with unit specifiers.
Get/Set the month formatting option. Possible values are:
Formats the month using numerals.
Formtas the month using traditional Japanese month names.
Get/Set the option to include a marker that declares the date as a traditional Japanese date.

(c) 2004-2008 Daisuke Maki <daisuke@endeworks.jp<gt>.