Search code examples
c#datetimetimestamphost

ManagedWiFi HostTimeStamp in C#


I used ManagedWifi Wrapper to get some data from SSID. In this case I tried to get TimeStamp from host, but problem is "I can't recognize those values". I think they are nanoseconds.

MSDN Example

Method call is:

public ulong hostTimestamp;
/// <summary>
/// The capability value from the beacon packet or probe response.
/// </summary>

Example:

130815262764460726
130815262774756744
130815262786924765
130815262799248787
130815262813600812
130815262824832832
130815262836064852
130815262846360870
130815262857592890
130815262913908988

I want grab date from those values in format "yyyyMMdd hh:ss".

Regards, Nerus


Solution

  • They are Ticks. To convert them to DateTime do the following:

    DateTime dt = new DateTime(130815262836064852);
    

    Then to get to the format you want:

    dt.ToString("yyyyMMdd hh:ss");