- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Social Studies
Fashion Studies
Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Convert the value of the current DateTime object to a Windows file time in C#
To convert the value of the current DateTime object to a Windows file time, the code is as follows −
Example
using System; public class Demo { public static void Main() { DateTime d = DateTime.Now; Console.WriteLine("Date = {0}", d); long res = d.ToFileTime(); Console.WriteLine("Windows file time = {0}", res); } }
Output
This will produce the following output −
Date = 10/16/2019 8:17:26 AM Windows file time = 132156874462559390
Example
Let us see another example −
using System; public class Demo { public static void Main() { DateTime d = new DateTime(2019, 05, 10, 6, 10, 25); Console.WriteLine("Date = {0}", d); long res = d.ToFileTime(); Console.WriteLine("Windows file time = {0}", res); } }
Output
This will produce the following output −
Date = 5/10/2019 6:10:25 AM Windows file time = 132019422250000000
- Related Articles
- Convert the value of the current DateTime object to UTC in C#
- Convert the specified Windows file time to an equivalent local time in C#
- Convert the Current Time to a java.sql.Date Object
- Pandas - Convert a Timestamp object to a native Python datetime object
- Get the String representation of the current File object in Java
- C# DateTime to add days to the current date
- Convert string of time to time object in Java
- How to convert a datetime string to millisecond UNIX time stamp?
- How to convert JS date time to MySQL datetime?
- How to convert timestamp string to datetime object in Python?
- Convert DateTime Value into String in MySQL?
- Get the creation time of a file in C#
- Inserting the current datetime in MongoDB?
- How to convert MySQL DATETIME value to JSON format in JavaScript?
- C# Program to get the last write time of a file

Advertisements