-
Notifications
You must be signed in to change notification settings - Fork 40
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
Showing
6 changed files
with
563 additions
and
469 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
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,23 @@ | ||
import json | ||
from datetime import datetime, timedelta | ||
|
||
# Read the JSON file | ||
with open('session.json', 'r') as file: | ||
sessions = json.load(file) | ||
|
||
# Initialize the new start date to 10 AM UTC 1st September 2024 | ||
new_start_date = datetime(2024, 9, 1, 10, 0, 0) | ||
|
||
# Iterate through each session and update the "Start" and "End" dates | ||
for session in sessions: | ||
duration = session['Duration'] | ||
session['Start'] = new_start_date.isoformat() + 'Z' | ||
end_date = new_start_date + timedelta(minutes=duration) | ||
session['End'] = end_date.isoformat() + 'Z' | ||
new_start_date = end_date # Update new_start_date for the next session | ||
|
||
# Save the updated JSON data back to the file | ||
with open('session.json', 'w') as file: | ||
json.dump(sessions, file, indent=4) | ||
|
||
print("Session times updated successfully.") |
Oops, something went wrong.