can I use ToFileTime for date-time in C# for Java(Android) project? my project connects to a server and the server gets time from me by ToFileTime format.
in C#
DateTime testdate1 = new DateTime(2000, 10, 11);
Console.WriteLine(testdate1.ToFileTime());
show -> 126156834000000000
Internally a DateTime stores the Ticks that happened since the begin of the UnixEpoch. Every other property and the string output are just an interpretation of that value.
"126156834000000000" looks very much like a tick value (as DateTime retreival lacks the precision to fill in those later digits). And ToFileTime() does indeed return the tick value.
Maybe you wanted the result of testdate1.ToString()
? But even that might be a bad idea.
I got 3 rules for working with Numbers and in particular Datetime:
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.