-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdate_of_transaction.py
33 lines (26 loc) · 1 KB
/
date_of_transaction.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
def extract_date ():
"""generate the date object at time of the recording"""
global current_date
from datetime import date
print()
print("date_of_transaction")
print("***************************************************")
print( "1) Today's date\n"
"2) Custom date")
print("___________________________________________________")
user_option = int(input("insert: "))
print("***************************************************")
if user_option == 1:
current_date = date.today()
elif user_option == 2:
custom_date = int(input("date:"))
custom_month = int(input("month:"))
custom_year = int(input("year:"))
print("***************************************************")
current_date = date(custom_year, custom_month, custom_date)
# format date to string format
current_date =current_date.strftime('%Y-%m-%d %H:%M:%S')
return current_date
if __name__ == "__main__":
date = extract_date()
print(date)