Martin John Neeson, from Magowan Park, appeared at Londonderry Magistrates' Court on Tuesday charged with grievous bodily harm (GBH).
The assault happened at Magowan Park at about 04:00 BST on 28 August.
A 35-year-old man from Ballykelly sustained serious head injuries in the incident and remains in a critical condition in hospital.
Mr Neeson is also charged with having a knife with intent to cause GBH.
Both offences are alleged to have taken place in the early hours of Sunday morning.
The defendant told the court that he "disagreed with all that".
He was remanded in custody until 5 September for a potential bail application.

Mrs Beshenivsky was killed outside a travel agency in Morley Street on 18 November 2005 while responding to an armed robbery call.
The service was held in Norfolk Gardens where a minute's silence was observed at the exact time she was shot.
Her husband Paul and family were joined by police colleagues.
The mother of three and stepmother of two died after she was shot in the chest on what was her youngest daughter Lydia's fourth birthday.
Her shift partner, PC Teresa Milburn, was also shot and injured during the incident.
Two men were jailed for life for her murder.
Dozens of new floral tributes have been left at the memorial in the city centre.
Ch Supt Simon Atkin, of West Yorkshire Police, said: "The memorial service for family, friends, colleagues and community members from across Bradford is to ensure that we can collectively come together to remember police constable 6410 Sharon Beshenivsky.
"Our thoughts are still with Paul and his family as we recall that fateful day 10 years ago when Sharon was killed in the line of duty.
"We come together as friends within the police family to reflect and support as we ensure that Sharon will not be forgotten."
Lord Mayor of Bradford Joanne Dodds said: "Sharon made the ultimate sacrifice and gave her life protecting us and ensuring we could continue to enjoy the liberty, freedom and way of life we all value so dearly."

Christopher Hales was found guilty of professional misconduct over property deals linked to MP Michelle Thomson.
She was elected an SNP MP but withdrew the party whip after the case emerged.
The Law Society found that claims staff might have deliberately halted progressing the case until after the election were "completely unfounded".
Mr Hales had carried out work for M&F Property Solutions, a firm businesswoman Ms Thomson was a partner of.
Following a hearing in May 2014, the Scottish Solicitors' Discipline Tribunal said Mr Hales failed to provide mortgage companies with key information used to prevent fraud and must have been aware that there was a possibility he was facilitating mortgage fraud, whether or not it occurred.
The deals he was investigated for had been carried out on behalf of M&F Property Solutions, a firm businesswoman Ms Thomson was a partner of.
She remains an MP at Westminster and has strenuously denied she did anything wrong.
After the link between Mr Hales and Ms Thomson came to light, the Law Society undertook a review of its handling of the case.
It concluded that;
Christine McLintock, president of the Law Society, said: "We took swift action after identifying the issues at Christopher Hales' firm in 2011, which included rapidly suspending Mr Hales from practice and making a suspicious activity report. Following our investigation we prosecuted him before the the Scottish Solicitors' Discipline Tribunal (SSDT) , which resulted in him being struck off.
"We said we would examine the issues raised as a result of this case to determine what lessons could be learned.
"We have now identified where operational improvements can be made and are taking these forward in conjunction with other organisations.
"This work will be overseen by the Society's Regulatory Committee, which comprises both solicitors and non-solicitors."
A 36-year-old man has appeared in court charged with attacking a man in Londonderry.
[NEXT_CONCEPT]
Family and colleagues of murdered PC Sharon Beshenivsky have paid tribute to the officer on the 10th anniversary of the day she was shot dead in Bradford.
[NEXT_CONCEPT]
A review into the handling of a case involving a solicitor who was struck off has found no wrongdoing by Law Society of Scotland staff.