-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
toravest
committed
Mar 16, 2025
1 parent
6e0a78a
commit dbc0fa1
Showing
1 changed file
with
47 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,47 @@ | ||
| # importing datetime module | ||
| import datetime | ||
| import time | ||
|
|
||
| start_date = input("Choose a start date (yyyy, mm, dd, hh, mm): ") | ||
| end_date = input("Choose an end date (yyyy, mm, dd, hh, mm): ") | ||
|
|
||
| # Variables that splits and assign the start date values | ||
| start_date = start_date.split(",") | ||
| start_year = int(start_date[0]) | ||
| start_month = int(start_date[1]) | ||
| start_date = int(start_date[2]) | ||
| start_hour = int(start_date[3]) | ||
| start_minute = int(start_date[4]) | ||
|
|
||
| # Variables that splits and assign the end date values | ||
| end_date = end_date.split(",") | ||
| end_year = int(end_date[0]) | ||
| end_month = int(end_date[1]) | ||
| end_date = int(end_date[2]) | ||
| end_hour = int(end_date[3]) | ||
| end_minute = int(end_date[4]) | ||
|
|
||
| # Converts start date to unix, and print, with the user input | ||
| start_date_unix = datetime.datetime(start_year, start_month, start_date, start_hour, start_minute) | ||
|
|
||
| # Print regular start date | ||
| print("date_time =>", start_date_unix) | ||
|
|
||
| # Print unix start date | ||
| print("unix_timestamp => ", | ||
| (time.mktime(start_date_unix.timetuple()))) | ||
|
|
||
|
|
||
| # Converts end date to unix, and print, with the user input | ||
| end_date_unix = datetime.datetime(end_year, end_month, end_date, end_hour, end_minute) | ||
|
|
||
| # Print regular end date | ||
| print("date_time =>", end_date_unix) | ||
|
|
||
| # Print unix end date | ||
| print("unix_timestamp => ", | ||
| (time.mktime(end_date_unix.timetuple()))) | ||
|
|
||
|
|
||
|
|
||
|
|