class documentation

class DateTimeFormat(object):

View In Hierarchy

Undocumented

Method __getitem__ Undocumented
Method __init__ Undocumented
Method extract Undocumented
Method format Undocumented
Method format​_day​_of​_week​_in​_month Undocumented
Method format​_day​_of​_year Undocumented
Method format​_era Undocumented
Method format​_frac​_seconds Return fractional seconds.
Method format​_milliseconds​_in​_day Undocumented
Method format​_month Undocumented
Method format​_period Undocumented
Method format​_quarter Undocumented
Method format​_timezone Undocumented
Method format​_week Undocumented
Method format​_weekday Return weekday from parsed datetime according to format pattern.
Method format​_year Undocumented
Method get​_day​_of​_year Undocumented
Method get​_week​_number Return the number of the week of a day within a period. This may be the week number in a year or the week number in a month.
Instance Variable locale Undocumented
Instance Variable value Undocumented
def __getitem__(self, name):

Undocumented

def __init__(self, value, locale):

Undocumented

def extract(self, char):

Undocumented

def format(self, value, length):

Undocumented

def format_day_of_week_in_month(self):

Undocumented

def format_day_of_year(self, num):

Undocumented

def format_era(self, char, num):

Undocumented

def format_frac_seconds(self, num):

Return fractional seconds.

Rounds the time's microseconds to the precision given by the number of digits passed in.

def format_milliseconds_in_day(self, num):

Undocumented

def format_month(self, char, num):

Undocumented

def format_period(self, char):

Undocumented

def format_quarter(self, char, num):

Undocumented

def format_timezone(self, char, num):

Undocumented

def format_week(self, char, num):

Undocumented

def format_weekday(self, char='E', num=4):

Return weekday from parsed datetime according to format pattern.

>>> format = DateTimeFormat(date(2016, 2, 28), Locale.parse('en_US'))
>>> format.format_weekday()
u'Sunday'
'E': Day of week - Use one through three letters for the abbreviated day name, four for the full (wide) name,
five for the narrow name, or six for the short name.
>>> format.format_weekday('E',2)
u'Sun'
'e': Local day of week. Same as E except adds a numeric value that will depend on the local starting day of the
week, using one or two letters. For this example, Monday is the first day of the week.
>>> format.format_weekday('e',2)
'01'
'c': Stand-Alone local day of week - Use one letter for the local numeric value (same as 'e'), three for the
abbreviated day name, four for the full (wide) name, five for the narrow name, or six for the short name.
>>> format.format_weekday('c',1)
'1'
Parameters
charpattern format character ('e','E','c')
numcount of format character
def format_year(self, char, num):

Undocumented

def get_day_of_year(self, date=None):

Undocumented

def get_week_number(self, day_of_period, day_of_week=None):

Return the number of the week of a day within a period. This may be the week number in a year or the week number in a month.

Usually this will return a value equal to or greater than 1, but if the first week of the period is so short that it actually counts as the last week of the previous period, this function will return 0.

>>> format = DateTimeFormat(date(2006, 1, 8), Locale.parse('de_DE'))
>>> format.get_week_number(6)
1
>>> format = DateTimeFormat(date(2006, 1, 8), Locale.parse('en_US'))
>>> format.get_week_number(6)
2
Parameters
day​_of​_periodthe number of the day in the period (usually either the day of month or the day of year)
day​_of​_weekthe week day; if ommitted, the week day of the current date is assumed
locale =

Undocumented

value =

Undocumented