from datetime import datetime, timedelta
# import locale
# locale.setlocale(locale.LC_ALL, '')

TIME_STR = "2022-06-10 16:16:16"
STD_TIME_STR_FMT = "%Y-%m-%d %H:%M:%S"   # 小写y是两位年份
CUR_TIME_STR_FMT = "%Y-%m-%d %H:%M:%S"


class MyTime(object):
    """
    操作方法:设置base tuple_path header
    """

    def __init__(self) -> None:
        self.cur_time_str_fmt = "%Y-%m-%d %H:%M:%S"
        self.std_time_str_fmt = "%Y-%m-%d %H:%M:%S"
        self.cur_time_str = ""
        self.std_time_str = ""
        self.cur_datetime = ""
        pass

    def setCurrentTimeStrFmt(self, s):
        self.cur_time_str_fmt = s
        pass

    def setStdTimeStrFmt(self, s):
        self.std_time_str_fmt = s
        pass

    def setCurrentTimeStr(self, s):
        self.cur_time_str = s
        self.cur_datetime = datetime.strptime(self.cur_time_str, self.cur_time_str_fmt)
        pass

    def setStdTimeStr(self, s):
        self.std_time_str = s
        self.cur_datetime = datetime.strptime(
            self.std_time_str, STD_TIME_STR_FMT)
        pass

    def Current2STD(self):
        # self.cur_datetime = datetime.strptime(self.cur_time_str , CUR_TIME_STR_FMT)
        self.std_time_str = datetime.strftime(
            self.cur_datetime, STD_TIME_STR_FMT)
        pass

    def STD2Current(self, format: str):
        # self.cur_datetime = datetime.strptime(self.std_time_str , STD_TIME_STR_FMT)
        self.cur_time_str = datetime.strftime(
            self.cur_datetime, CUR_TIME_STR_FMT)
        pass

    def timeDelta(self, days=0, seconds=0, microseconds=0, milliseconds=0, minutes=0, hours=0, weeks=0):
        self.cur_datetime = self.cur_datetime + \
            timedelta(days=0, seconds=0, microseconds=0,
                      milliseconds=0, minutes=0, hours=0, weeks=0)
        pass


if __name__ == "__main__":
    s = "2023-02-07 14:02:46"
    mt = MyTime()
    mt.setCurrentTimeStr(s)
    print(mt.cur_datetime)
    pass
