Skip to main content
added 32 characters in body
Source Link
TheLethalCoder
  • 7.2k
  • 27
  • 43

C#, 46 bytes

s=>System.DateTime.Parse(s).ToString("HH:mm");

Strings are taken in input like 12:00 AM

Doing the same thing but substringing on the output from the default call to ToString (Assuming a culture of en-GB) is 3 bytes longer for 49 bytes:

s=>(System.DateTime.Parse(s)+"").Substring(11,5);

C#, 46 bytes

s=>System.DateTime.Parse(s).ToString("HH:mm");

Doing the same thing but substringing on the output from the default call to ToString is 3 bytes longer for 49 bytes:

s=>(System.DateTime.Parse(s)+"").Substring(11,5);

C#, 46 bytes

s=>System.DateTime.Parse(s).ToString("HH:mm");

Strings are taken in input like 12:00 AM

Doing the same thing but substringing on the output from the default call to ToString (Assuming a culture of en-GB) is 3 bytes longer for 49 bytes:

s=>(System.DateTime.Parse(s)+"").Substring(11,5);
Source Link
TheLethalCoder
  • 7.2k
  • 27
  • 43

C#, 46 bytes

s=>System.DateTime.Parse(s).ToString("HH:mm");

Doing the same thing but substringing on the output from the default call to ToString is 3 bytes longer for 49 bytes:

s=>(System.DateTime.Parse(s)+"").Substring(11,5);