-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDateTime.py
More file actions
97 lines (35 loc) · 635 Bytes
/
DateTime.py
File metadata and controls
97 lines (35 loc) · 635 Bytes
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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
#!/usr/bin/env python
# coding: utf-8
# In[1]:
import datetime
# In[4]:
# hour , minute , second , microsecond
t = datetime.time(14,5,5)
# In[8]:
print(t)
# In[10]:
# you can get minute hour and seconds individually
t.minute
# In[11]:
print(datetime.time.min)
# In[12]:
print(datetime.time.max)
# In[18]:
# for getting todays date
today = datetime.date.today()
print(today)
# In[19]:
today.timetuple()
# In[20]:
today.month
# In[21]:
today.day
# In[22]:
d1 = datetime.date(2019,12,31)
# In[24]:
print(d1)
# In[25]:
d2 = d1.replace(year = 2020)
# In[26]:
print(d2)
# In[ ]: