GSP
Quick Navigator

Search Site

Unix VPS
A - Starter
B - Basic
C - Preferred
D - Commercial
MPS - Dedicated
Previous VPSs
* Sign Up! *

Support
Contact Us
Online Help
Handbooks
Domain Status
Man Pages

FAQ
Virtual Servers
Pricing
Billing
Technical

Network
Facilities
Connectivity
Topology Map

Miscellaneous
Server Agreement
Year 2038
Credits
 

USA Flag

 

 

Man Pages
DateTime::Format::Japanese::Traditional(3) User Contributed Perl Documentation DateTime::Format::Japanese::Traditional(3)

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:
FORMAT_ROMAN
Formats the numbers in plain ascii roman numerals.
FORMAT_KANJI
Formats numbers in kanji numerals without any unit specifiers.
FORMAT_ZENKAKU
Formats numbers in zenkaku numerals (double-byte equivalent of roman numerals)
FORMAT_KANJI_WITH_UNIT
Formats numbers in kanji numerals, with unit specifiers.

Get/Set the month formatting option. Possible values are:
FORMAT_NUMERIC_MONTH
Formats the month using numerals.
FORMAT_WAREKI_MONTH
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>.

Hey! The above document had some coding errors, which are explained below:
Around line 394:
Non-ASCII character seen before =encoding in '$fmt->parse_datetime("大化三年弥生三日丑三つ刻");'. Assuming UTF-8
2008-08-24 perl v5.32.1

Search for    or go to Top of page |  Section 3 |  Main Index

Powered by GSP Visit the GSP FreeBSD Man Page Interface.
Output converted with ManDoc.