Extracting simple times

I am making a bus time page for a singular bus stop and need help using data from the API to display times in a clear way. I currently extract data raw from the API and the time till the bus arrives is given in seconds (from the API) and the time outputs in ISO 8601 format. I would like to output time to the bus stop in minutes with the actual time outputted. I am using Django for this and attached is my code.

HTML code:

    {% for i in response %}
    <button class="button">{{i.lineId}} to
    {{i.destinationName}} </button> | 
   <body class="time"> <!--{{i.timeToStation}} seconds |--> {{i.expectedArrival}}</body> <button class ="button" style= background-color:yellow>Registration Plate: {{i.vehicleId}}</button><br><br>
        {% endfor %}

Views.py:

def home2(request):
    bluewater = '2400A070090A'
response=requests.get(f'https://api.tfl.gov.uk/StopPoint/{bluewater}/Arrivals')
    data = response.json()
return render(request,'home.html',{'response':data})

@AMH

OK, just looking at How To Get Current Time In Django - Python Guides looks like to format a time in minutes and seconds by prepending

…strftime(’%H:%M’)

to format the output to Hours and Minutes.

1 Like

For some reason it still doesn’t seem to work. I’ve been forced to use the expectedArrival part of the API but it’s frustrating having 2022-11-09T11:10:10Z printed out as opposed to just simply 11:10