yoginnee xcs projhect final (1)
yoginnee xcs projhect final (1)
yoginnee xcs projhect final (1)
GANDHINAGAR
PROJECT
“'Date & Time Utility Manager”
[Teacher in-charge]
[Internal Examiner] [External Examiner]
Subject Teacher,
Computer Science
[J.N.V.GANDHINAGAR]
Index
Acknowledgement
Key Features
Technologies Used
Database Structure
Steps to Execute
Source Code of Project and
explanation
Output Screens
Benefits
Bibliography
Acknowledgement
I would like to express my deepest gratitude to all those
who have contributed to the successful completion of this
investigatory project.
def day_of_week(date):
# Parse the date in DD-MM-YYYY format
date_obj = datetime.strptime(date, "%d-%m-%Y")
return calendar.day_name[date_obj.weekday()]
def calculate_age(birth_date):
today = datetime.today()
birth_date_obj = datetime.strptime(birth_date, "%Y-%m-%d")
age = today.year - birth_date_obj.year
if today.month < birth_date_obj.month or (today.month ==
birth_date_obj.month and today.day < birth_date_obj.day):
age -= 1
return age
conn = mysql.connector.connect(
host="localhost",
user="root",
password="Jnvg@6",
database="datetimereminder"
)
cursor = conn.cursor()
conn.commit()
conn.close()
except mysql.connector.Error as e:
print(f"Error setting up the database: {e}")
SOURCE CODE
# Log Operations
def log_operation(operation):
try:
conn = mysql.connector.connect(
host="localhost",
user="root",
password="Jnvg@6",
database="datetimereminder"
)
cursor = conn.cursor()
cursor.execute("INSERT INTO logs (operation, timestamp) VALUES (%s,
%s)", (operation, datetime.now()))
conn.commit()
conn.close()
except mysql.connector.Error as e:
print(f"Error logging operation: {e}")
if reminders:
for reminder in reminders:
print(f"Reminder: {reminder[1]}")
cursor.execute("DELETE FROM reminders WHERE id =
%s", (reminder[0],))
conn.commit()
else:
print("No due reminders.")
conn.close()
except mysql.connector.Error as e:
print(f"Error checking reminders: {e}")
SOURCE CODE
if logs:
print("\n===== All Logs =====")
for log in logs:
print(f"ID: {log[0]} | Operation: {log[1]} | Timestamp: {log[2]}")
else:
print("No logs found.")
conn.close()
except mysql.connector.Error as e:
print(f"Error viewing logs: {e}")
SOURCE CODE
# Main Program
if __name__ == "__main__":
setup_database()
while True:
print("\n===== Date & Time Utilities =====")
print("1. Leap Year Checker")
print("2. Current Date & Time Display")
print("3. Find Day of the Week")
print("4. Age Calculator")
print("5. Days Between Two Dates")
print("6. Set Reminder")
print("7. Check Reminders")
print("8. View Reminder Log")
print("9. Exit")
SOURCE CODE
choice = input("Enter the number of the option you want to use: ")
if choice == '1':
year = int(input("Enter a year to check if it's a leap year: "))
print(f"{year} is a leap year." if is_leap_year(year) else f"{year} is not a leap
year.")
else:
print("Invalid choice. Please try again!")
SOURCE CODE
elif choice == '7':
check_reminders()
else:
print("Invalid choice. Please try again!")
OUTOUT SCREENS
1. Leap Year Checker
INPUT:
OUTPUT:
OUTOUT SCREENS
2. Current Date & Time Display
INPUT:
OUTPUT:
OUTOUT SCREENS
3.Age Calculator
INPUT:
OUTPUT:
OUTOUT SCREENS
4. Set Reminder
INPUT:
OUTPUT:
OUTOUT SCREENS
5. Check Reminders
INPUT:
OUTPUT:
OUTOUT SCREENS
6. View Reminder Logs
INPUT:
OUTPUT:
Benefits
1. Combines utility tools with a
robust reminder system.
2. Simple and intuitive interface for
users.
3. Stores reminders and logs
securely in a database for future
reference.
Bibliography