© 2004-22

Python Dates
Code examples to help you understand the date and time functions available in Python
Method Description
Timer Setup a simple execution timer
Execution Time Formatted Time a piece of code with formatted output
Get current date and time Return date and time into separate variables for use in code. Shows how to re-format date output.
Convert string to time Input a text string and convert to date. Shows how to re-format output
Elapsed time using input from user Accept input from user, converts to date-time and calculates difference in time from now
Users age Calculate the users age from an input date string
Date and Time Formatting text strings as standard date-time