Skip to content

Commit 18c2049

Browse files
Update date_and_time.md
1 parent 336a822 commit 18c2049

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

snippets/python/date_and_time.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,6 @@ import datetime
1111
# now() method returns current datetime object
1212
cur_time = datetime.datetime.now()
1313
14-
print("Date: ", cur_time.day, "/", cur_time.month, "/", cur_time.year)
15-
print("Time: ", cur_time.hour, "h:", cur_time.minute, "m:", cur_time.second, "s")
14+
print("Date today:",f"{cur_time:%Y-%m-%d}")
15+
print("Time:", f"{cur_time:%H:%M:%S%z}")
1616
```

0 commit comments

Comments
 (0)