Answers for "local time python"

1

how to get the local time in python

from datetime import datetime
import time
now = datetime.now()
while True:
    print(now.strftime("local time :- %X"))
    time.sleep(2)
Posted by: Guest on October-03-2021
0

python - oordinated universal time

from datetime import datetime, timezone
print(datetime.now())              # timezone
print(datetime.now(timezone.utc))  # coordinated universal time
Posted by: Guest on August-13-2020

Python Answers by Framework

Browse Popular Code Answers by Language