Skip to content

Instantly share code, notes, and snippets.

@FounderDAO
Created January 17, 2023 14:16
Show Gist options
  • Select an option

  • Save FounderDAO/8fc33237308e27b2715397ab8161fb53 to your computer and use it in GitHub Desktop.

Select an option

Save FounderDAO/8fc33237308e27b2715397ab8161fb53 to your computer and use it in GitHub Desktop.
from datetime import datetime
def to_isoformat(dt: datetime) -> str:
return (
dt.isoformat(timespec="milliseconds")
.replace("+00:00", "Z")
.replace(".000Z", "Z")
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment