It uses the current culture to format the time - CSharp System

CSharp examples for System:DateTime Format

Description

It uses the current culture to format the time

Demo Code


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);
		}
}

Related Tutorials