- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
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
DateTime.FromFileTime() Method in C#
The DateTime.FromFileTime() method in C# is used to convert the specified Windows file time to an equivalent local time.
Syntax
Following is the syntax −
public static DateTime FromFileTime (long fileTime);
Above, the parameter lifetime is a Windows file time expressed in ticks.
Example
Let us now see an example to implement the DateTime.FromFileTime() method −
using System; public class Demo { public static void Main() { DateTime d1 = DateTime.FromFileTime(100000000000); System.Console.WriteLine("DateTime = {0:dd} {0:y}, {0:hh}:{0:mm}:{0:ss} ",d1); } }
Output
This will produce the following output −
DateTime = 01 January 1601, 02:46:40
Example
Let us now see another example to implement the DateTime.FromFileTime() method −
using System; public class Demo { public static void Main() { DateTime d1 = DateTime.FromFileTime(0); System.Console.WriteLine("DateTime = {0:dd} {0:y}, {0:hh}:{0:mm}:{0:ss} ",d1); } }
Output
This will produce the following output −
DateTime = 01 January 1601, 12:00:00
Advertisements