# Showtime.py Copyright (c) Kari Laitinen # http://www.naturalprogramming.com # 2006-05-20 File created. # 2022-12-27 Converted to Python 3. from datetime import datetime # The weekday() method of class datetime returns the day of the week as # an integer, where Monday is 0 and Sunday is 6. See also isoweekday(). names_of_days_of_week = ( "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday" ) names_of_months = ( "January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December" ) date_and_time_now = datetime.today() print( "\n Current time is: %d:%02d:%02d.%03d" % \ ( date_and_time_now.hour, date_and_time_now.minute, date_and_time_now.second, date_and_time_now.microsecond ) ) print( "\n Current date is: %s, day %d of %s in year %d." % \ ( names_of_days_of_week[ date_and_time_now.weekday() ], date_and_time_now.day, names_of_months[ date_and_time_now.month - 1 ], date_and_time_now.year ) ) print( "\n ISO date and time: %s" % date_and_time_now.isoformat( " " ), end="" ) print( "\n ctime(): %s" % date_and_time_now.ctime() ) print( "\n Locale day of week: %s" % date_and_time_now.strftime( "%A" ), end="" ) print( "\n Locale date and time: %s" % date_and_time_now.strftime( "%c" ), end="" ) print( "\n Locale date: %s" % date_and_time_now.strftime( "%x" ), end="" ) print( "\n Locale time: %s" % date_and_time_now.strftime( "%X" ) ) # See Python Library Reference documentation for more information # about the parameters that can be supplied to the srtftime() method. # See class tzinfo documentation for information related to time zones.