Mar-04-2019, 07:46 PM
Hey guys,
I'm trying to change the date format of when an AWS server was launched into something more readable for the user.
I'm getting this error:
I'm trying to change the date format of when an AWS server was launched into something more readable for the user.
I'm getting this error:
Error:Traceback (most recent call last):
File ".\aws_ec2_terminate_instances.py", line 47, in <module>
datetime(launch_time)
TypeError: an integer is required (got type datetime.datetime)
And this is my code:import datetime from datetime import datetime instance = ec2.describe_instances( InstanceIds=[instance_id] )['Reservations'][0]['Instances'][0] launch_time = instance['LaunchTime'] datetime(launch_time) launch_time_friendly = launch_time.strftime("%B %d %Y") print("Server was launched at: ", launch_time_friendly)This is the value of launch_time:
2019-03-04 19:13:20+00:00How can I go about this in the correct way?