I am scraping web series data from JSON
and lists
using python. the problem is with date and time.
I got a function to convert the duration
format
def get_duration(secs):
hour = int(secs/3600)
secs = secs - hour*3600
minute = int(secs/60)
if hour == 0:
return "00:" + str(minute)
elif len(str(hour)) == 1:
return "0" + str(hour) + ":" + str(minute)
return str(hour) + ":" + str(minute)
The output is 00:29
which is correct.
But how can I convert broadCastDate
to DD-MM-YYYY format
Here is the Data
"items": [
{
"duration": 1778,
"startDate": 1555893000,
"endDate": 4102424940,
"broadCastDate": 1555939800,
}
]
The Broadcast Date on the website is 22 Apr 2019, so need a function to get this type of output.