-
Notifications
You must be signed in to change notification settings - Fork 0
/
util.py
49 lines (37 loc) · 992 Bytes
/
util.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
'''
random util functions
'''
import datetime
from datetime import date
def get_date(date_string):
'''
datetime object returner
'''
return datetime.datetime.strptime(date_string, "%Y-%m-%d").date()
def get_title(location, count):
'''
get week string for playlist creation
'''
start, end = get_days(count)
return str(start.month) + "/" + str(start.day) + " –– " \
+ str(end.month) + "/" + str(end.day) + " in " + location
def get_days(end):
'''
return today's date
'''
return date.today(), date.today() + datetime.timedelta(end, 0)
def get_three_days():
'''
good for weekends, not ideal, will fix later
'''
return date.today() + datetime.timedelta(3, 0)
def get_next_week():
'''
return date a week from today
'''
return date.today() + datetime.timedelta(7, 0)
def get_next_month():
'''
return date a month from today
'''
return date.today() + datetime.timedelta(30, 0)