コード例 #1
0
ファイル: datetime.py プロジェクト: eventable/PyCalendar
 def getMonthText(self, short_txt):
     # Make sure range is valid
     if (self.mMonth < 1) or (self.mMonth > 12):
         return ""
     else:
         return locale.getMonth(self.mMonth, [locale.SHORT,
                                              locale.LONG][not short_txt])
コード例 #2
0
ファイル: datetime.py プロジェクト: eventable/PyCalendar
 def getMonthText(self, short_txt):
     # Make sure range is valid
     if (self.mMonth < 1) or (self.mMonth > 12):
         return ""
     else:
         return locale.getMonth(
             self.mMonth,
             [locale.SHORT, locale.LONG][not short_txt]
         )
コード例 #3
0
ファイル: datetime.py プロジェクト: gingerkaan/serveros
    def getLocaleDate(self, dateTimeFormat):

        buf = StringIO.StringIO()

        if dateTimeFormat == DateTime.FULLDATE:
            buf.write(locale.getDay(self.getDayOfWeek(), locale.LONG))
            buf.write(", ")
            buf.write(locale.getMonth(self.mMonth, locale.LONG))
            buf.write(" ")
            buf.write(str(self.mDay))
            buf.write(", ")
            buf.write(str(self.mYear))
        elif dateTimeFormat == DateTime.ABBREVDATE:
            buf.write(locale.getDay(self.getDayOfWeek(), locale.SHORT))
            buf.write(", ")
            buf.write(locale.getMonth(self.mMonth, locale.SHORT))
            buf.write(" ")
            buf.write(str(self.mDay))
            buf.write(", ")
            buf.write(str(self.mYear))
        elif dateTimeFormat == DateTime.NUMERICDATE:
            buf.write(str(self.mMonth))
            buf.write("/")
            buf.write(str(self.mDay))
            buf.write("/")
            buf.write(str(self.mYear))
        elif dateTimeFormat == DateTime.FULLDATENOYEAR:
            buf.write(locale.getDay(self.getDayOfWeek(), locale.LONG))
            buf.write(", ")
            buf.write(locale.getMonth(self.mMonth, locale.LONG))
            buf.write(" ")
            buf.write(str(self.mDay))
        elif dateTimeFormat == DateTime.ABBREVDATENOYEAR:
            buf.write(locale.getDay(self. getDayOfWeek(), locale.SHORT))
            buf.write(", ")
            buf.write(locale.getMonth(self.mMonth, locale.SHORT))
            buf.write(" ")
            buf.write(str(self.mDay))
        elif dateTimeFormat == DateTime.NUMERICDATENOYEAR:
            buf.write(str(self.mMonth))
            buf.write("/")
            buf.write(str(self.mDay))

        return buf.getvalue()
コード例 #4
0
ファイル: datetime.py プロジェクト: eventable/PyCalendar
    def getLocaleDate(self, dateTimeFormat):

        buf = StringIO.StringIO()

        if dateTimeFormat == DateTime.FULLDATE:
            buf.write(locale.getDay(self.getDayOfWeek(), locale.LONG))
            buf.write(", ")
            buf.write(locale.getMonth(self.mMonth, locale.LONG))
            buf.write(" ")
            buf.write(str(self.mDay))
            buf.write(", ")
            buf.write(str(self.mYear))
        elif dateTimeFormat == DateTime.ABBREVDATE:
            buf.write(locale.getDay(self.getDayOfWeek(), locale.SHORT))
            buf.write(", ")
            buf.write(locale.getMonth(self.mMonth, locale.SHORT))
            buf.write(" ")
            buf.write(str(self.mDay))
            buf.write(", ")
            buf.write(str(self.mYear))
        elif dateTimeFormat == DateTime.NUMERICDATE:
            buf.write(str(self.mMonth))
            buf.write("/")
            buf.write(str(self.mDay))
            buf.write("/")
            buf.write(str(self.mYear))
        elif dateTimeFormat == DateTime.FULLDATENOYEAR:
            buf.write(locale.getDay(self.getDayOfWeek(), locale.LONG))
            buf.write(", ")
            buf.write(locale.getMonth(self.mMonth, locale.LONG))
            buf.write(" ")
            buf.write(str(self.mDay))
        elif dateTimeFormat == DateTime.ABBREVDATENOYEAR:
            buf.write(locale.getDay(self. getDayOfWeek(), locale.SHORT))
            buf.write(", ")
            buf.write(locale.getMonth(self.mMonth, locale.SHORT))
            buf.write(" ")
            buf.write(str(self.mDay))
        elif dateTimeFormat == DateTime.NUMERICDATENOYEAR:
            buf.write(str(self.mMonth))
            buf.write("/")
            buf.write(str(self.mDay))

        return buf.getvalue()