CSharp examples for System:DateTime Format
It uses the current culture to format the time
using System.Globalization; using System;//from www . j a va 2 s .c om public class Main{ /// <summary> /// It uses the current culture to format the time /// </summary> /// <returns>The short time string.</returns> /// <param name="dateTime">Date time.</param> public static string ToShortTimeString (this DateTime dateTime) { return dateTime.ToString("t", DateTimeFormatInfo.CurrentInfo); } }