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

CSharp examples for System:DateTime Convert

Description

Converts the specified into an unspecified kind of time. The actual date and time will remain unchanged.

Demo Code


using System.Diagnostics;
using System;// ww  w.  j  a  va  2s .c  om

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

Related Tutorials