Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

Errors that you will get during date object in python datetime

# Python program to demonstrate date class
# import the date class
from datetime import date

# initializing constructor and passing arguments in the format year, month, date
# will raise an ValueError as date is outside range
my_date2 = date(1999, 3, 69)
print(my_date2)

# will raise a TypeError as a string is passed instead of integer
my_date3 = date('1999', 3, 5)
print(my_date3)

# will raise a Error of leading zeros
my_date4 = date(1999, 03, 05)
print("Date passed as argument is", my_date4)
Source by softhunt.net #
 
PREVIOUS NEXT
Tagged: #Errors #date #object #python #datetime
ADD COMMENT
Topic
Name
1+9 =