How to convert python datetime
to AWSTimestamp
- appsync scalar type?
Python format: 2021-07-14 09:11:48.563323
to
AWSTimestamp format: 1930-01-01T16:00:00-07:00
How to convert python datetime
to AWSTimestamp
- appsync scalar type?
Python format: 2021-07-14 09:11:48.563323
to
AWSTimestamp format: 1930-01-01T16:00:00-07:00
Use the below method to convert python datetime
to AWSTimestamp
def convert_to_aws_timestamp(timestamp):
return str(timestamp)[:-3].replace(" ", "T") + "Z"
Try to user strftime from a datetime
For example something like
myDate.strftime('%Y-%m-%dT%H:%M:%S.000Z')
To obtain "2022-09-27T08:32:51.000Z"
But anyway your format looks strange, try to add more information, as was asked by FObersteiner