Skip to content

Commit 26c5bcc

Browse files
authored
Update tz_tool.py
1 parent fa12e95 commit 26c5bcc

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

timezone_cli/tz_tool.py

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
from pytz import timezone
55
from dateutil.relativedelta import relativedelta
66

7+
78
# --- INFO ON PARAMS ---
89
def print_help():
910
print('[+] use --cu and pass custom timezone to find time.')
@@ -12,12 +13,14 @@ def print_help():
1213
print('[+] use --help again if needed.')
1314
print('\n' + '-'*50 + '\n')
1415

16+
1517
# --- GET DATETIME OF PASSED TIMEZONE ---
1618
def get_datetime(time_zone):
1719
utcnow = timezone('utc').localize(datetime.utcnow())
1820
output_datetime = utcnow.astimezone(timezone(time_zone)).replace(tzinfo=None)
1921
return output_datetime
2022

23+
2124
# --- GET DATETIME OF CUSTOM TIMEZONE ---
2225
def get_custom_tz(time_zone):
2326
response = str(get_datetime(time_zone))
@@ -30,6 +33,7 @@ def get_custom_tz(time_zone):
3033
print('%20s' % 'Date' + ' :' + ' '*2 + date)
3134
print('\n' + '-'*50 + '\n')
3235

36+
3337
# --- GET DATETIMES OF COMMON TIMEZONES ---
3438
def get_common_tz():
3539
common_tz_list = [
@@ -45,9 +49,10 @@ def get_common_tz():
4549
'Australia/Melbourne',
4650
]
4751
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+
5156

5257
# --- COMPARE DIFFERENCES BTW TWO TIMEZONES ---
5358
def get_comparisons(tz_1, tz_2):
@@ -60,6 +65,7 @@ def get_comparisons(tz_1, tz_2):
6065
print('%25s' % 'Seconds :', offset.seconds)
6166
print('\n' + '-'*50 + '\n')
6267

68+
6369
# --- MAIN FUNCTION ---
6470
def Main():
6571
print('\n' + '-'*50 + '\n')

0 commit comments

Comments
 (0)