def dateString(dato): """ Return a datetime as a nicely formatted string """ if dato.time() == time.min: return dato.strftime('%Y-%m-%d') else: return dato.strftime('%Y-%m-%d %H:%M')