def datetime_ceil(dateval):
 if (dateval.microsecond > 0):
  return (dateval + timedelta(seconds=1, microseconds=(- dateval.microsecond)))
 return dateval

def datetime_ceil ( dateval ) : if ( dateval . microsecond > 0 ) : return ( dateval + timedelta ( seconds = 1 , microseconds = ( - dateval . microsecond ) ) ) return dateval
rounds the given datetime object upwards .