-
Notifications
You must be signed in to change notification settings - Fork 0
/
date_time.py
64 lines (47 loc) · 1.47 KB
/
date_time.py
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
# -*- coding: utf-8 -*-
"""
Created on Thu Oct 17 23:03:19 2019
@author: Satvik Chachra
"""
import datetime
import random
birthday=[]
i=0
while(i<50):
year = random.randint(2018,2019)
if(year%4==0 and(year%100!=0 or year%400==0)):
leap=1
else:
leap=0
month = random.randint(1,12)
if(month==2 and leap==1):
day=random.randint(1,29)
elif(month==2 and leap==0):
day = random.randint(1,28)
elif(month%2==0 and month<7):
day = random.randint(1,30)
elif(month%2!=0 and month<=7):
day=random.randint(1,31)
elif(month%2!=0 and month>7):
day=random.randint(1,30)
else:
day=random.randint(1,31)
dd = datetime.date(year,month,day)
birthday.append(dd)
i=i+1
birthday.sort()
for i in range(0,50):
print(birthday[i]," ", birthday.count(birthday[i]))
# =============================================================================
#
#
# print(datetime.date.today())
# #print(datetime.datetime.now("%Y"))
# print("Week No Of Today",datetime.date.today().strftime("%W")) # prints week no of current day (%W)<br>
# print("weekday of week ",datetime.date.today().strftime("%w"))
# print("day of year ",datetime.date.today().strftime("%j"))
# print("day of week ",datetime.date.today().strftime("%A"))
#
#
#
# =============================================================================