code: def fmt_datetime(d, fmt='', local=True):
      
      if not d:
          return ''
      if local:
          from django.templatetags.tz import localtime
          d = localtime(d)
      if not fmt:
          fmt = '%Y-%m-%d %H-%M'
      return d.strftime(fmt)
docs: format date with local support
      ``d``: datetime to format
      ``fmt``: format, default is '%Y-%m-%d %H-%M'
      ``local``: format as local time