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.
A 36-year-old man has appeared in court charged with attacking a man in Londonderry.