티스토리 뷰

Programming/python

python datetime library

RosyPark 2019. 9. 11. 11:19
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
 
unixtime1 = 1514735577.775000000000
unix_timestamp_plus_5_min = unixtime1 + (6 * 60#6분후
print("unix_timestamp_plus_5_min",unix_timestamp_plus_5_min)
 
 
= 1514734859.55
= 1514735272.40
datetimeobj1 = datetime.fromtimestamp(a).strftime('%H:%M:%S')
datetimeobj2 = datetime.fromtimestamp(b).strftime('%H:%M:%S')
 
print("datetimeobj1",datetimeobj1) #00:40:59
print("datetimeobj2",datetimeobj2) #00:47:52
 
 
 
 
unixtime2 = 1514736004.200000000000
datetimeobj1 = datetime.fromtimestamp(unixtime1).strftime('%H:%M:%S')
datetimeobj2 = datetime.fromtimestamp(unixtime2).strftime('%H:%M:%S')
 
print("datetimeobj1",datetimeobj1) #00:52:57
print("datetimeobj2",datetimeobj2) #01:00:04
cs
댓글
공지사항
최근에 올라온 글
최근에 달린 댓글
Total
Today
Yesterday
링크
TAG more
«   2024/11   »
1 2
3 4 5 6 7 8 9
10 11 12 13 14 15 16
17 18 19 20 21 22 23
24 25 26 27 28 29 30
글 보관함