Created
November 2, 2021 06:28
-
-
Save Mulperi/065c87e990f03cc3d76cfcbc9283c41f to your computer and use it in GitHub Desktop.
python datetime object remove microseconds
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from datetime import datetime, date, time, timezone | |
dt = datetime.utcnow() | |
print(dt) | |
newtime = dt.replace(microsecond=0) | |
print(newtime) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment