Converts the specified into a specific kind of time. The actual date and time will remain unchanged. - CSharp System

CSharp examples for System:DateTime Convert

Description

Converts the specified into a specific kind of time. The actual date and time will remain unchanged.

Demo Code


using System.Diagnostics;
using System;/* w  ww  .j av a2  s .c o  m*/

public class Main{
        /// <summary>
		/// Converts the specified <see cref="DateTime"/> into a specific kind of time. The actual date and time will remain unchanged.
		/// </summary>
		/// <param name="dateTime">A <see cref="DateTime"/>.</param>
		/// <param name="kind">A <see cref="DateTimeKind"/>.</param>
		/// <returns><paramref name="dateTime"/> as a <paramref name="kind"/> of time.</returns>
		public static DateTime AsKind(this DateTime dateTime, DateTimeKind kind)
		{
			return DateTime.SpecifyKind(dateTime, kind);
		}
}

Related Tutorials