This method is used to create a new DateTime object which has the same number of ticks as the specified DateTime but is designated as either local time, Coordinated Universal Time (UTC), or neither, as indicated by the specified DateTimeKind value.
Syntax: public static DateTime SpecifyKind (DateTime value, DateTimeKind kind);
value: It is the date and time.
kind: It is one of the enumeration values which indicates whether the new object represents local time, UTC, or neither.
Return Value: This method returns a new object that has the same number of ticks as the object represented by the value parameter and the DateTimeKind value specified by the kind parameter.
Below programs illustrate the use of DateTime.SpecifyKind(DateTime, DateTimeKind) Method:
Kind Before Using Method: Unspecified Kind After Using Method: Local DateTime is 05/06/2005 14:34:42
DateTime is 01/01/1970 04:00:15
- Difference between Method Overriding and Method Hiding in C#
- DateTime.Add() Method in C#
- C# | Math.Log() Method
- C# | ToUpper() Method
- C# | ToLower() Method
- C# | Method Overloading
- C# | Math.Abs() Method | Set - 1
- DateTimeOffset.Add() Method in C#
- C# | Math.Abs() Method | Set - 2
- Extension Method in C#
- C# | Uri.GetHashCode() Method
- C# | Method Parameters
- C# | Math.Exp() Method
- C# | SortedDictionary.Add() Method
- C# | StartsWith() Method
- Anonymous Method in C#
- C# | Uri.IsHexEncoding() Method
- C# | CompareOrdinal() Method
- C# | Copy() Method
- C# | Math.Pow() Method
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to email@example.com. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.