Hi all,
I am sorry for making another post 3 times in a week, but I am almost complete my project. I have converted from
When I try this:
It give me an error: TypeError: expected string or buffer
The error are highlight on this line:
Here is the datetime object for
I don't have a clue what to do as I don't know how to fix it. What I am trying to do is to get the day, month, year, 12 hours time, minutes with PM to make it to show like "23/02/2018 23:00PM" from variable called
Can you please help me with how we can solve the error to allow me to convert it back to
Thanks in advance
I am sorry for making another post 3 times in a week, but I am almost complete my project. I have converted from
time.struct_time
to datetime
object. Now I would like to convert it back to time.struct_time
object after I have added to the next day date. When I try this:
1 2 3 4 5 6 7 8 9 |
half_hour_date = '23/02/2018 23:00PM' epg_time_1 = time.strptime(half_hour_date, '%d/%m/%Y %I:%M%p' ) #convert from time_struct_time object to datetime date_format = datetime.datetime.fromtimestamp(time.mktime(epg_time_1)) half_hour = date_format + datetime.timedelta(days = self .program_day) #convert from datetime to time_struct_time object epg_time_1 = time.strptime(half_hour, '%d/%m/%Y %I:%M%p' ) |
The error are highlight on this line:
1 |
epg_time_1 = time.strptime(half_hour, '%d/%m/%Y %I:%M%p' ) |
half_hour
:1 |
2018 - 02 - 23 23 : 00 : 00 |
half_hour
Can you please help me with how we can solve the error to allow me to convert it back to
time.struct_time
object?Thanks in advance