In my C# program I'm receiving datetime from a PLC. It is sending data in "ulong" format. How can I convert ulong to DateTime format? for example I am receiving:
ulong timeN = 99844490909448899;//time in nanoseconds
then I need to convert it into DateTime ("MM/dd/yyyy hh:mm:ss") format.
How can I solve this?
100-nanosecond intervals that have elapsed since January 1, 0001 at 00:00:00.000 in the Gregorian calendar.
you can use this DateTime constructors that takes a long. – Burmeister2000/01/01 00:00 UTC
. – Tetrodevar d = new DateTime(timeN/100)
. (Because ticks is in 100 nanoseconds interval). – Thierry