MCPcopy Create free account
hub / github.com/EasyIME/PIME / format_day

Method format_day

python/python3/tornado/locale.py:428–448  ·  view source on GitHub ↗

Formats the given date as a day of week. Example: "Monday, January 22". You can remove the day of week with ``dow=False``.

(
        self, date: datetime.datetime, gmt_offset: int = 0, dow: bool = True
    )

Source from the content-addressed store, hash-verified

426 }
427
428 def format_day(
429 self, date: datetime.datetime, gmt_offset: int = 0, dow: bool = True
430 ) -> bool:
431 """Formats the given date as a day of week.
432
433 Example: "Monday, January 22". You can remove the day of week with
434 ``dow=False``.
435 """
436 local_date = date - datetime.timedelta(minutes=gmt_offset)
437 _ = self.translate
438 if dow:
439 return _("%(weekday)s, %(month_name)s %(day)s") % {
440 "month_name": self._months[local_date.month - 1],
441 "weekday": self._weekdays[local_date.weekday()],
442 "day": str(local_date.day),
443 }
444 else:
445 return _("%(month_name)s %(day)s") % {
446 "month_name": self._months[local_date.month - 1],
447 "day": str(local_date.day),
448 }
449
450 def list(self, parts: Any) -> str:
451 """Returns a comma-separated list for the given list of parts.

Callers 1

test_format_dayMethod · 0.80

Calls 1

_Function · 0.50

Tested by 1

test_format_dayMethod · 0.64