How to exclude seconds from DateTime.ToString()

c#, datetime

Solution

Output it as short date pattern:

DateTime.Now.ToString("g")

See MSDN for full documentation.

Problem

I am using DateTime.Now.ToString() in a windows service and it is giving me output like "7/23/2010 12:35:07 PM " I want to exclude the second part, displaying only up to minute. So how to exclude seconds from that format...?

Original source