890. Early Kiddush and Havdalah
Shabbos 29:11
One may recite kiddush over wine on Friday before sunset even though Shabbos has not yet started. Similarly, one may recite havdalah over a cup of wine before sunset even though it is still Shabbos. This is because the mitzvah of remembering Shabbos involves making a verbal declaration at the beginning and end of Shabbos, or slightly before these times.
Shabbos 29:12
If person is in the middle of a meal when Shabbos arrives, he should cover the table, recite kiddush, finish his meal and “bentch” (i.e., recite grace after meals). If a person is in the middle of a meal when Shabbos ends, he should finish his meal, wash his hands (mayim achronim), bentch over a cup of wine and then recite havdalah over that cup. If a person is sitting and drinking, he should stop drinking, recite havdalah and then resume drinking.