Skip to content

Commit 336a822

Browse files
Create date_and_time.md
1 parent e3b8ce8 commit 336a822

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

snippets/python/date_and_time.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
# Check Current Date and Time
2+
3+
*tags:* python, datetime
4+
5+
`datetime`: The datetime module supplies classes for manipulating dates and times.
6+
7+
### Snippet
8+
```
9+
import datetime
10+
11+
# now() method returns current datetime object
12+
cur_time = datetime.datetime.now()
13+
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")
16+
```

0 commit comments

Comments
 (0)