Answers for "python datetime gmt"

1

python datetime to utc

from datetime import timezone

timestamp = dt.replace(tzinfo=timezone.utc).timestamp()
Posted by: Guest on August-05-2020
1

python datetime to utc

from datetime import timezone

timestamp = dt.replace(tzinfo=timezone.utc).timestamp()
Posted by: Guest on August-05-2020
14

python datetime now

import datetime
print(datetime.datetime.now()) #datetime.datetime.now() is the syntax
Posted by: Guest on March-29-2020
14

python datetime now

import datetime
print(datetime.datetime.now()) #datetime.datetime.now() is the syntax
Posted by: Guest on March-29-2020
2

timestamp 1601825400 in python

from datetime import datetime

timestamp = 1545730073
dt_object = datetime.fromtimestamp(timestamp)

print("dt_object =", dt_object)
print("type(dt_object) =", type(dt_object))
Posted by: Guest on November-10-2020
2

timestamp 1601825400 in python

from datetime import datetime

timestamp = 1545730073
dt_object = datetime.fromtimestamp(timestamp)

print("dt_object =", dt_object)
print("type(dt_object) =", type(dt_object))
Posted by: Guest on November-10-2020
0

datetime decreasing date python

from datetime import datetime, timedelta

d = datetime.today() - timedelta(days=days_to_subtract)
Posted by: Guest on May-31-2020
0

datetime decreasing date python

from datetime import datetime, timedelta

d = datetime.today() - timedelta(days=days_to_subtract)
Posted by: Guest on May-31-2020

Python Answers by Framework

Browse Popular Code Answers by Language