format date before comparision.