[Solved] strftime(“%A”) output is string. but assigning variable is expecting Int [closed]


There’s two issues.

First, to get the day of the month, you should use %d, not %A with strftime().

date = time.strftime("%d");

Second, this returns the day as a string, not as an integer, but datetime.date() requires its arguments to be integers, so you need to convert it with int(date)

date = int(time.strftime("%d"))

But there’s really no need to use strftime() in the first place. If you have a date object, you can simply access its day property to get the day of the month.

solved strftime(“%A”) output is string. but assigning variable is expecting Int [closed]