Update date.cpp

replaced switch with if