4
4
from pytz import timezone
5
5
from dateutil .relativedelta import relativedelta
6
6
7
+
7
8
# --- INFO ON PARAMS ---
8
9
def print_help ():
9
10
print ('[+] use --cu and pass custom timezone to find time.' )
@@ -12,12 +13,14 @@ def print_help():
12
13
print ('[+] use --help again if needed.' )
13
14
print ('\n ' + '-' * 50 + '\n ' )
14
15
16
+
15
17
# --- GET DATETIME OF PASSED TIMEZONE ---
16
18
def get_datetime (time_zone ):
17
19
utcnow = timezone ('utc' ).localize (datetime .utcnow ())
18
20
output_datetime = utcnow .astimezone (timezone (time_zone )).replace (tzinfo = None )
19
21
return output_datetime
20
22
23
+
21
24
# --- GET DATETIME OF CUSTOM TIMEZONE ---
22
25
def get_custom_tz (time_zone ):
23
26
response = str (get_datetime (time_zone ))
@@ -30,6 +33,7 @@ def get_custom_tz(time_zone):
30
33
print ('%20s' % 'Date' + ' :' + ' ' * 2 + date )
31
34
print ('\n ' + '-' * 50 + '\n ' )
32
35
36
+
33
37
# --- GET DATETIMES OF COMMON TIMEZONES ---
34
38
def get_common_tz ():
35
39
common_tz_list = [
@@ -45,9 +49,10 @@ def get_common_tz():
45
49
'Australia/Melbourne' ,
46
50
]
47
51
for item in common_tz_list :
48
- print ('%-20s' % item , end = '' )
49
- print (':' + ' ' * 2 + str (get_datetime (item )))
50
- print ('\n ' + '-' * 50 + '\n ' )
52
+ print ('%-20s' % item , end = '' )
53
+ print (':' + ' ' * 2 + str (get_datetime (item )))
54
+ print ('\n ' + '-' * 50 + '\n ' )
55
+
51
56
52
57
# --- COMPARE DIFFERENCES BTW TWO TIMEZONES ---
53
58
def get_comparisons (tz_1 , tz_2 ):
@@ -60,6 +65,7 @@ def get_comparisons(tz_1, tz_2):
60
65
print ('%25s' % 'Seconds :' , offset .seconds )
61
66
print ('\n ' + '-' * 50 + '\n ' )
62
67
68
+
63
69
# --- MAIN FUNCTION ---
64
70
def Main ():
65
71
print ('\n ' + '-' * 50 + '\n ' )
0 commit comments