Quick Navigator

Search Site

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

Contact Us
Online Help
Domain Status
Man Pages

Virtual Servers

Topology Map

Server Agreement
Year 2038

USA Flag



Man Pages

Manual Reference Pages  -  DATETIME::LOCALE::FROMDATA (3)

.ds Aq ’


DateTime::Locale::FromData - Class for locale objects instantiated from pre-defined data



version 1.03


  my $locale = DateTime::Locale::FromData->new(%lots_of_data)


This class is used to represent locales instantiated from the data in the DateTime::Locale::Data module.


This class provides the following methods:
o $locale->code

The complete locale id, something like en-US.

o $locale->language_code

The language portion of the code, like en.

o $locale->script_code

The script portion of the code, like Hant.

o $locale->territory_code

The territory portion of the code, like US.

o $locale->variant_code

The variant portion of the code, like POSIX.

o $locale->name

The locale’s complete name, which always includes at least a language component, plus optional territory and variant components. Something like English United States. The value returned will always be in English.

o $locale->language
o $locale->script
o $locale->territory
o $locale->variant

The relevant component from the locale’s complete name, like English or United States.

o $locale->native_name

The locale’s complete name in localized form as a UTF-8 string.

o $locale->native_language
o $locale->native_script
o $locale->native_territory
o $locale->native_variant

The relevant component from the locale’s complete native name as a UTF-8 string.

The following methods all return an array reference containing the specified data.

The methods with format in the name should return strings that can be used a part of a string, like the month of July. The stand alone values are for use in things like calendars as opposed to a sentence.

The narrow forms may not be unique (for example, in the day column heading for a calendar it’s okay to have T for both Tuesday and Thursday).

The wide name should always be the full name of thing in question. The narrow name should be just one or two characters.
o $locale->month_format_wide
o $locale->month_format_abbreviated
o $locale->month_format_narrow
o $locale->month_stand_alone_wide
o $locale->month_stand_alone_abbreviated
o $locale->month_stand_alone_narrow
o $locale->day_format_wide
o $locale->day_format_abbreviated
o $locale->day_format_narrow
o $locale->day_stand_alone_wide
o $locale->day_stand_alone_abbreviated
o $locale->day_stand_alone_narrow
o $locale->quarter_format_wide
o $locale->quarter_format_abbreviated
o $locale->quarter_format_narrow
o $locale->quarter_stand_alone_wide
o $locale->quarter_stand_alone_abbreviated
o $locale->quarter_stand_alone_narrow
o $locale->am_pm_abbreviated
o $locale->era_wide
o $locale->era_abbreviated
o $locale->era_narrow
The following methods return strings appropriate for the DateTime->format_cldr method:
o $locale->date_format_full
o $locale->date_format_long
o $locale->date_format_medium
o $locale->date_format_short
o $locale->time_format_full
o $locale->time_format_long
o $locale->time_format_medium
o $locale->time_format_short
o $locale->datetime_format_full
o $locale->datetime_format_long
o $locale->datetime_format_medium
o $locale->datetime_format_short
A locale may also offer one or more formats for displaying part of a datetime, such as the year and month, or hour and minute.
o $locale->format_for($name)

These are accessed by passing a name to $locale->format_for(...), where the name is a CLDR-style format specifier.

The return value is a string suitable for passing to $dt->format_cldr, so you can do something like this:

  print $dt->format_cldr( $dt->locale->format_for(MMMdd) )

which for the en locale would print out something like 08 Jul.

Note that the localization may also include additional text specific to the locale. For example, the MMMMd format for the zh locale includes the Chinese characters for day (X) and month (X), so you get something like 8X23X.

o $locale->available_formats

This should return a list of all the format names that could be passed to $locale->format_for.

There are also some miscellaneous methods:
o $locale->prefers_24_hour_time

Returns a boolean indicating whether or not the locale prefers 24-hour time.

o $locale->first_day_of_week

Returns a number from 1 to 7 indicating the local first day of the week, with Monday being 1 and Sunday being 7.

o $locale->version

The CLDR version from which this locale was generated.


Bugs may be submitted through the RT bug tracker <> (or <>).

There is a mailing list available for users of this distribution, <>.

I am also usually active on IRC as ’drolsky’ on irc://


Dave Rolsky <>


This software is copyright (c) 2016 by Dave Rolsky.

This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.

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

perl v5.20.3 DATETIME::LOCALE::FROMDATA (3) 2016-03-25

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