def datetime_format_to_js_datetime_format(format):
 converted = format
 replacements = {'%Y': 'yyyy', '%y': 'yy', '%m': 'mm', '%d': 'dd', '%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_datetime_format ( format ) : converted = format replacements = { '%Y' : 'yyyy' , '%y' : 'yy' , '%m' : 'mm' , '%d' : 'dd' , '%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 datetime picker we use .