示例#1
0
文件: date.py 项目: moxwose/freeIBS
    def __init__(self,date,date_unit):
	date_unit=date_unit.lower()
	if date_unit in ["jalali","gregorian"]:
	    AbsDate.__init__(self,date,date_unit)
	else:
	    date=time_lib.dbTimeFromEpoch(time.time()+self.__getDateInSeconds(date,date_unit))
	    AbsDate.__init__(self,date,"gregorian")
示例#2
0
    def __init__(self, date, date_unit, go_past=True):
        """
            date(string): date value
            date_unit(string): unit of date can be "jalali" "gregorian" "years" "months" "days" "hours" "minutes"
            go_past(bool): if date_unit is not absolute (jalali , gregorian) should we subtract or add relative
                           date to now
                           if go_past is true, we subtract relative date from now
        """
        date_unit = date_unit.lower()
        if date_unit in ["jalali", "gregorian"]:
            AbsDate.__init__(self, date, date_unit)
        else:
            if go_past:
                op = operator.sub
            else:
                op = operator.add

            date = time_lib.dbTimeFromEpoch(
                op(time.time(), self.__getDateInSeconds(date, date_unit)))
            AbsDate.__init__(self, date, "gregorian")
示例#3
0
文件: date.py 项目: moxwose/freeIBS
def AbsDateFromEpoch(epoch_time):
    	return AbsDate(time_lib.dbTimeFromEpoch(epoch_time),"gregorian")
	
示例#4
0
def AbsDateFromEpoch(epoch_time):
    return AbsDate(time_lib.dbTimeFromEpoch(epoch_time), "gregorian")