I have a view which has the following code. I need to translate am and pm to arabic
which is display by %p. I called this in template by ajax.I tried by doing
_strptime("%I:%M %p")
,bit its not working. Here this code strftime("%I:%M %p")
is used
to display time 1:00AM to 2:00 PM. How will i translate this:
result['start'] = datetime.strptime((str(delivery_area_timing.start)[:-3]),
"%H:%M").strftime("%I:%M %p")
Ajax code:
$("#shop_work_hours").html(data.start+' {% trans 'to' %} '+data.end);
This is not done by Translation in Django. You will have to set the locale for printing a date in that language. For e.g. printing date in Arabic (must be supported by your OS):