Taking the pill ony period

Will the pill be effective if I take it the first day of my period?