Two police officers were confronted by a "grinning" knifeman when they left their station at the end of a shift.
The women, who had changed out of their uniforms, had got into their separate cars near the police station at Railway Row in Sunderland, when Josh Dorward approached, in the dark, carrying a carving knife with a ten inch blade.
The court heard one officer had no central locking in her vehicle and her car door was open.
Dorward did not attempt to get into either car but both women were terrified by his behaviour on March 2.
Newcastle Crown Court heard one officer described the 25-year-old "making a twisting movement with the knife, toward her" and making eye contact.
Prosecutor Emma Dowling told the court: "She described him grinning when he did this."
Dorward then approached the second car and "made a stabbing motion, again grinning".
The court heard when Dorward walked away from the scene, the two officers followed him and called for back-up.
Dorward, who has a criminal record, was seen going into a nearby house but had already gone when more police arrived at the scene.
He was arrested later.
Miss Dowling told the court: "The defendant in interview said he couldn't remember it at all as he was so drunk."
Dorward, who lived opposite the station at Railway Row, Sunderland, admitted using threatening behaviour and having a bladed article.
Judge Edward Bindloss sentenced him to eight months behind bars.
The judge told him: "This was two women, at night, coming off shift from doing their public duty.
"They are entitled to go home unthreatened.
"You caused them, understandably, significant fear.
"You were drunk, armed and out of control in dangerous circumstances.
"Thankfully, you didn't use the knife, thankfully, you didn't get into either of the cars.
"Nothing came of it but that is not what your victims perceived, there was a man, in the dark, with a knife, outside their cars.
"You caused them understandable fear."
Vic Laffey, defending, said Dorward is "deeply upset" and genuinely sorry for the distress he caused the two women, who he did not know were police officers.
Mr Laffey said Dorward had been upset about the looming anniversary of his grandfather's death when he got drunk and distressed that night.
Mr Laffey added: "He certainly has no animosity to anyone in the police service.
"He had lived opposite the police station without any problem for years.
"He had no idea they were police officers."
Mr Laffey said Dorward has been out of trouble for five years, has a stable relationship and an offer of employment.