Source Code:
(back to article)
import json from datetime import datetime # Create a datetime object now = datetime.now() # Serialize the object to a JSON formatted string json_str = json.dumps(now.isoformat()) print(json_str)
Result:
Report an issue