This method is used to convert the value of the current DateTime object to a Windows file time.
Syntax: public long ToFileTime ();
Return Value: This method returns the value of the current DateTime object expressed as a Windows file time.
Exception: This method will give ArgumentOutOfRangeException if the resulting file time would represent a date and time before 12:00 midnight January 1, 1601 C.E. UTC.
Below programs illustrate the use of DateTime.ToFileTime() Method:
Windows file time is 129383280150000000
Example 2: For ArgumentOutOfRangeException
Exception Thrown: System.ArgumentOutOfRangeException
- Difference between Method Overriding and Method Hiding in C#
- Stack.Contains() Method in C#
- Stack.Pop() Method in C#
- C# | ToUpper() Method
- C# | ToLower() Method
- C# | Math.Abs() Method | Set - 2
- C# | PadLeft() Method
- Queue.Contains() Method in C#
- C# | Method Overloading
- C# | Math.Max() Method
- C# | Math.Cos() Method
- C# | Math.Exp() Method
- C# | Math.Sin() Method
- C# | String.Contains() Method
- C# | IndexOfAny() 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.