Skip to content

Commit 1a29826

Browse files
authored
Update StringTime.py
1 parent 44348cf commit 1a29826

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

StringTime.py

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,3 +16,23 @@
1616

1717
date_time = now.strftime("%m/%d/%Y, %H:%M:%S")
1818
print("date and time:",date_time)
19+
20+
21+
from datetime import datetime
22+
23+
timestamp = 1528797322
24+
date_time = datetime.fromtimestamp(timestamp)
25+
26+
print("Date time object:", date_time)
27+
28+
d = date_time.strftime("%m/%d/%Y, %H:%M:%S")
29+
print("Output 2:", d)
30+
31+
d = date_time.strftime("%d %b, %Y")
32+
print("Output 3:", d)
33+
34+
d = date_time.strftime("%d %B, %Y")
35+
print("Output 4:", d)
36+
37+
d = date_time.strftime("%I%p")
38+
print("Output 5:", d)

0 commit comments

Comments
 (0)