def extract_date(value):
    """
    Convert timestamp to datetime and set everything to zero except a date
    """
    dtime = value.to_datetime()
    dtime = (dtime - timedelta(hours=dtime.hour) - timedelta(minutes=dtime.minute) -
             timedelta(seconds=dtime.second) - timedelta(microseconds=dtime.microsecond))
    return dtime
Convert timestamp to datetime and set everything to zero except a date