def datetime_format_to_js_time_format(format):
 try:
  format = format.split()[1]
 except IndexError:
  pass
 converted = format
 replacements = {'%H': 'hh', '%I': 'HH', '%M': 'ii', '%S': 'ss'}
 for (search, replace) in replacements.items():
  converted = converted.replace(search, replace)
 return converted.strip()

def datetime_format_to_js_time_format ( format ) : try : format = format . split ( ) [ 1 ] except IndexError : pass converted = format replacements = { '%H' : 'hh' , '%I' : 'HH' , '%M' : 'ii' , '%S' : 'ss' } for ( search , replace ) in replacements . items ( ) : converted = converted . replace ( search , replace ) return converted . strip ( )
convert a python datetime format to a time format suitable for use with the js time picker we use .