try:
=IF(AND(A1>=6/24,A1<=22/24),"P","")

or if it contains dates:
=IF(AND(MOD(A1,1)>=6/24,MOD(A1,1)<=22/24),"P","")