...with strftime.
strftime
The most common representations are:
"%Y-%m-%d" "%Y-%m-%d %H:%M" "%H:%M:%S"
The ISO 8601 standard on Wikipedia.