def weekdayHalf(self): """ %a """ if self.english: return EnglishChar.half_day(self.npDateTime.week_day) return NepaliChar.half_day(self.npDateTime.week_day)
def yearFull(self): """ %Y """ if self.english: return str(self.npDateTime.year) return NepaliChar.number(self.npDateTime.year)
def monthFull(self): """ %B or %b """ if self.english: return EnglishChar.month(self.npDateTime.month) return NepaliChar.month(self.npDateTime.month)
def weekdayNumber(self): """ %w """ if self.english: return str(self.npDateTime.week_day - 1) return NepaliChar.number(self.npDateTime.week_day - 1)
def weekdayFull(self): """ %A """ if self.english: return EnglishChar.day(self.npDateTime.week_day) return NepaliChar.day(self.npDateTime.week_day)
def yearHalf(self): """ %y """ if self.english: return str(self.npDateTime.year)[2:] return NepaliChar.number(str(self.npDateTime.year)[2:])
def day_nonzero(self): """ %D """ day = str(self.npDateTime.day) if self.english: return str(day) return NepaliChar.number(day)
def monthNumber_nonzero(self): """ %m """ month = str(self.npDateTime.month) if self.english: return str(month) return NepaliChar.number(month)
def second_nonzero(self): """ %S """ second = str(self.npDateTime.second) if self.english: return str(second) return NepaliChar.number(second)
def hour24_nonzero(self): """ %H """ hour = self.npDateTime.hour if self.english: return str(hour) return NepaliChar.number(hour)
def minute_nonzero(self): """ %M """ minute = str(self.npDateTime.minute) if self.english: return str(minute) return NepaliChar.number(minute)
def second(self): """ %S """ second = str(self.npDateTime.second) if len(second) < 2: second = '0' + second if self.english: return str(second) return NepaliChar.number(second)
def minute(self): """ %M """ minute = str(self.npDateTime.minute) if len(minute) < 2: minute = '0' + minute if self.english: return str(minute) return NepaliChar.number(minute)
def hour24(self): """ %H """ hour = str(self.npDateTime.hour) if len(hour) < 2: hour = '0' + hour if self.english: return str(hour) return NepaliChar.number(hour)
def day(self): """ %d """ day = str(self.npDateTime.day) if len(day) < 2: day = '0' + day if self.english: return str(day) return NepaliChar.number(day)
def monthNumber(self): """ %m """ month = str(self.npDateTime.month) if len(month) < 2: month = '0' + month if self.english: return str(month) return NepaliChar.number(month)
def hour12_nonzero(self): """ %I """ hour = self.npDateTime.hour if hour > 12: hour = hour - 12 if hour == 0: hour = 12 hour = str(hour) if self.english: return str(hour) return NepaliChar.number(hour)
def get_humanize(self): """ returns humanize datetime """ self.__calc_seconds() # refreshing seconds interval_value = 0 interval_text = "" if (self.seconds == 0): # now return self.__now_text elif (self.seconds < 60): # seconds interval_value = self.seconds interval_text = self.__second_text elif (self.seconds < 3600): # minute interval_value = self.seconds // 60 interval_text = self.__minute_text elif (self.seconds < 86400): # hour interval_value = self.seconds // 3600 interval_text = self.__hour_text elif (self.seconds < 2592000): # day interval_value = self.seconds // 86400 interval_text = self.__day_text elif (self.seconds < 946080000): # month interval_value = self.seconds // 2592000 interval_text = self.__month_text else: # year interval_value = self.seconds // 946080000 interval_text = self.__year_text interval_value = NepaliChar.number(interval_value) return str(interval_value) + ' ' + str( interval_text) + ' ' + self.interval_tense