Python 3.7.4 (tags/v3.7.4:e09359112e, Jul 8 2019, 19:29:22) [MSC v.1916 32 bit (Intel)] on win32
Type "help", "copyright", "credits" or "license()" for more information.
>>> from datetime import datetime, timedelta
>>> import time
>>>
>>> datetime.now()
datetime.datetime(2020, 4, 30, 1, 4, 46, 559438)
>>>
>>> datetime.today()
datetime.datetime(2020, 4, 30, 1, 4, 53, 306922)
>>>
>>> time.time()
1588176300.3362236
>>>
>>> datetime.fromtimestamp(time.time())
datetime.datetime(2020, 4, 30, 1, 13, 38, 927519)
>>>
>>> datetime.fromisoformat('2020-04-29 00:05:23.283')
datetime.datetime(2020, 4, 29, 0, 5, 23, 283000)
>>>
>>> datetime.now().hour
1
>>>
>>> datetime.now().hour - 1
0
>>>
>>> timedelta(hours=-1)
datetime.timedelta(days=-1, seconds=82800)
>>>
>>> timedelta(hours=1)
datetime.timedelta(seconds=3600)
>>>
>>>
>>> datetime.now() - timedelta(hours=1)
datetime.datetime(2020, 4, 30, 0, 6, 47, 290874)
>>>
>>>
>>> datetime.now().strftime("%Y/%m/%d %H:%M:%S")
'2020/04/30 01:07:07'
>>>
>>> (datetime.now() - timedelta(hours=1)).strftime("%Y/%m/%d %H:%M:%S")
'2020/04/30 00:07:13'
>>>
>>>
# 1시간이 경과했는지 확인
>>> for _dir in pathlib.Path("C:\\Work\\Software\\eclipse-jee-2019-12-R-win32-x86_64\\workspace\\Blog\\media\\upload\\temp").iterdir():
print('Y' if datetime.fromtimestamp(_dir.stat().st_mtime) < (datetime.now() - timedelta(hours = 1)) else 'N', _dir.name)
N 새 폴더
N 새 폴더 (2)
N 새 폴더 (3)
N 새 폴더 (4)
datetime library
|
2020.04.29 16:22:38
|
2020.04.30 01:32:05
|
468
|
Aiden
Total of Attached file
0.00 Bytes of 0 files
2020.08.30
2020.08.23
2020.08.23
2020.08.22
2020.04.29
2020.04.28
2020.03.07
2020.02.29
2020.02.16
2020.02.01