Horje
Python can't subtract offset-naive and offset-aware datetimes Code Example
Python can't subtract offset-naive and offset-aware datetimes
import dateutil, datetime, pytz
LastDate = dateutil.parser.parse('2020-06-06 00:00:00+00:00')
now = datetime.datetime.now()
# Remove the TimeZone extension.
if (now - LastDate.replace(tzinfo=None) ).days >1:
    print("This works")
# OR, make current datetime aware of the timezone
now = pytz.utc.localize(now)
if (now - LastDate ).days >1:
    print("This works too")




Python

Related
pandas read tab separated file Code Example pandas read tab separated file Code Example
how to code a clickable button in python Code Example how to code a clickable button in python Code Example
what is python Code Example what is python Code Example
pass python parameters via cmd Code Example pass python parameters via cmd Code Example
pandas multiple string contains Code Example pandas multiple string contains Code Example

Type:
Code Example
Category:
Coding
Sub Category:
Code Example
Uploaded by:
Admin
Views:
7