Python Forum
How To Create A "Birthday Calculator" in Python?
Thread Rating:
  • 1 Vote(s) - 5 Average
  • 1
  • 2
  • 3
  • 4
  • 5
How To Create A "Birthday Calculator" in Python?
#2
The following page explains, using examples, most of the datetime methods: https://pymotw.com/3/datetime/

here are some helpers:

import datetime

# to get today's date
today = datetime.date.today()

# to calculate date for Feb 29, 2012 (a leap year)
thedate = datetime.date(2012, 2, 29)

# to get delta in days form today (this is an absolute value)
delta = today - thedate

print(f"The delta is {delta.days} days")
Output:
The delta is 3509 days
Reply


Messages In This Thread
RE: How To Create A "Birthday Calculator" in Python? - by Larz60+ - Oct-08-2021, 04:30 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Need some help trying to get my Python mortgage amortization calculator to work prope IamSirAskAlot 4 15,795 Feb-12-2024, 10:53 PM
Last Post: BerniceBerger
  New to python, trying to make a basic calculator AthertonH 2 1,162 Apr-14-2022, 03:33 PM
Last Post: AthertonH
  python calculator only using decomposing functions kirt6405 1 1,787 Jun-19-2021, 12:52 AM
Last Post: bowlofred
  Python calculator divide by zero help dock1926 4 5,891 Jan-20-2020, 05:15 PM
Last Post: michael1789
  Python Program to Make a Simple Calculator jack_sparrow007 2 10,217 Oct-19-2018, 08:32 AM
Last Post: volcano63
  Creating a Calculator with Python KatherineHov 8 7,784 Aug-03-2017, 02:13 PM
Last Post: sparkz_alot
  Python Calculator Application MemeStealer 6 7,848 Jul-21-2017, 08:42 PM
Last Post: MemeStealer

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020