class DateTimeFormat: (source)
Undocumented
Method | __getitem__ |
Undocumented |
Method | __init__ |
Undocumented |
Method | extract |
Undocumented |
Method | format |
Undocumented |
Method | format |
Undocumented |
Method | format |
Undocumented |
Method | format |
Undocumented |
Method | format |
Return fractional seconds. |
Method | format |
Undocumented |
Method | format |
Undocumented |
Method | format |
Return period from parsed datetime according to format pattern. |
Method | format |
Undocumented |
Method | format |
Undocumented |
Method | format |
Undocumented |
Method | format |
Return weekday from parsed datetime according to format pattern. |
Method | format |
Undocumented |
Method | get |
Undocumented |
Method | get |
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 | reference |
Undocumented |
Instance Variable | value |
Undocumented |
datetime.date|datetime.time
, locale: Locale|str
, reference_date: datetime.date|None
= None):
(source)
¶
Undocumented
Return fractional seconds. Rounds the time's microseconds to the precision given by the number of digits passed in.
Return period from parsed datetime according to format pattern. >>> from datetime import datetime, time >>> format = DateTimeFormat(time(13, 42), 'fi_FI') >>> format.format_period('a', 1) u'ip.' >>> format.format_period('b', 1) u'iltap.' >>> format.format_period('b', 4) u'iltapäivä' >>> format.format_period('B', 4) u'iltapäivällä' >>> format.format_period('B', 5) u'ip.' >>> format = DateTimeFormat(datetime(2022, 4, 28, 6, 27), 'zh_Hant') >>> format.format_period('a', 1) u'上午' >>> format.format_period('b', 1) u'清晨' >>> format.format_period('B', 1) u'清晨' :param char: pattern format character ('a', 'b', 'B') :param num: count of format character
Return weekday from parsed datetime according to format pattern. >>> from datetime import date >>> 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' :param char: pattern format character ('e','E','c') :param num: count of format character
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. >>> date = datetime.date(2006, 1, 8) >>> DateTimeFormat(date, 'de_DE').get_week_number(6) 1 >>> DateTimeFormat(date, 'en_US').get_week_number(6) 2 :param day_of_period: the number of the day in the period (usually either the day of month or the day of year) :param day_of_week: the week day; if omitted, the week day of the current date is assumed