C#: Windows file time to an equivalent UTC time
C# Sharp DateTime: Exercise-23 with Solution
Write a C# Sharp Program to convert the specified Windows file time to an equivalent UTC time.
Sample Solution:-
C# Sharp Code:
using System;
public class Example23
{
public static void Main(String[] argv)
{
// Attempt to convert a file time in Universal Time format to a DateTime object
// Note: 12123123123123123 is just an example file time value
DateTime dt = DateTime.FromFileTimeUtc(12123123123123123);
// Output the resulting DateTime object after conversion
System.Console.WriteLine(dt);
}
}
Sample Output:
6/2/1639 9:25:12 AM
Flowchart:
C# Sharp Code Editor:
Improve this sample solution and post your code through Disqus
Previous: Write a C# Sharp program which shows that when a time that falls within this range is converted to a long integer value and is then restored and the original value is adjusted to become a valid time.
Next: Write a C# Sharp program to display the string representation of a date using all possible standard date and time formats in the computer's current culture (en-US.).
What is the difficulty level of this exercise?
Test your Programming skills with w3resource's quiz.
It will be nice if you may share this link in any developer community or anywhere else, from where other developers may find this content. Thanks.
https://www.w3resource.com/csharp-exercises/datetime/csharp-datetime-exercise-23.php
- Weekly Trends and Language Statistics
- Weekly Trends and Language Statistics