12345678910111213141516171819202122232425 |
- # -*- coding: utf-8 -*-
- # @Time : 2022/12/1 14:14
- # @Author : XuJiakai
- # @File : datetime_utils
- # @Software: PyCharm
- import time
- import datetime
- def get_ds():
- return time.strftime("%Y%m%d")
- def get_now():
- return datetime.datetime.now().strftime('%Y-%m-%d %H:%M:%S')
- def datetime_format_transform(datetime_str: str, source_format: str, target_format: str):
- middle = datetime.datetime.strptime(datetime_str, source_format)
- return datetime.datetime.strftime(middle, target_format)
- pass
- if __name__ == '__main__':
- pass
|