He had previously pleaded guilty to intentionally impeding the normal breathing of a woman by applying pressure to her throat and neck - more commonly know as strangulation.
Gray was sentenced to 20 months in jail and was declined leave to apply for home detention. He had no suitable address for electronic monitoring so jail was the only option for him.
There would also be six months of release conditions he has to abide by on the completion of his jail term.
Defence lawyer John Day said Gray had pleaded guilty before the start of a judge-alone trial, which meant the victim did not have to give evidence in an open courtroom.
Gray had no previous violence convictions and was remorseful. Day described Gray's offending as "short but nasty".
On December 28 last year, just 25 days after the new legislation acknowledging strangulation as an offence was introduced, Gray tried to strangle his partner of six months.
The police summary of facts said Gray and his partner got into a verbal argument which rapidly escalated to him throwing a child's plastic toy, hitting her in the ribs. When the woman screamed for help Gray grabbed her by the shoulders and tried to get her inside.
When she continued to yell for help Gray put his arm around her throat, pulled her into the house and dragged her into a bedroom demanding she be quiet. She managed to run outside again and yell for help. Gray grabbed her and punched her in the body multiple times.
Judge Rollo said the physical and emotional impact had been significant for the woman.
New Zealand has the worst rate of family and intimate-partner violence in the developed world, with police called to an incident every four minutes.
The change in legislation was part of the Family Violence Amendment Act, replacing the Domestic Violence Act and carries a maximum penalty of seven years' imprisonment.
The reason for a specific offence of strangulation is that it is a type of asphyxiation now understood to be one of the most lethal forms of domestic violence.
Unconsciousness can occur within seconds, and death within minutes.
Jodie Harris, team leader at Women's Refuge Tryphina House in Whangārei, said strangulation was a red flag for woman and their situation needed addressing urgently.
"People who restrict the breathing of others don't just do it once. The frequency and increasing force escalates rapidly and can lead to death," Harris said.
She said since the new legislation was introduced police and health professionals were asking the right questions and more women were disclosing information about strangulation.
She advised anyone in a violent relationship who had been subjected to strangulation to seek advice immediately through a trusted health professional, police or women's refuge. Anyone who wants advice can contact Women's Refuge 0800 refuge or 0800 733 843.