datetime - Getting the date before with python -
i want yesterday's date, error:
typeerror: unsupported operand type(s) -: 'builtin_function_or_method' , 'datetime.timedelta'
code:
import datetime today = datetime.date.today day = datetime.timedelta(days = 1) yesterday = today - day
you have use ()
. way not creating reference method , getting "builtin_function_or_method" rather, calling , getting datetime
object:
import datetime today = datetime.date.today() day = datetime.timedelta(days = 1) yesterday = today - day
Comments
Post a Comment