擅长:python、mysql、java
<pre><code>from datetime import datetime
string_time = "2021-01-29T13:29:19.668Z"
# see https://strftime.org/ for definitions of strftime directives
dt_format = "%Y-%m-%dT%H:%M:%S.%fZ"
output_format = "%b %d, %Y @ %-I:%-M%p" # the %p is uppercase AM or PM
output = datetime.strftime(datetime.strptime(string_time, dt_format), output_format)
# lower case the last 2 characters of output
# and join with all characters except the last 2
print(''.join((output[:-2], output[-2:].lower())))
</code></pre>
<p>输出:<code>Jan 29, 2021 @ 1:29pm</code></p>