Packet.Timestamp.ToString("yyyy-MM-dd hh:mm:ss") not working in Vb.Net

Jun 21, 2012 at 9:09 AM


Firstly thanks so much for this wrapper :)

secondly in your C# examples you have this line which prints the packets timestamp.

Packet.Timestamp.ToString("yyyy-MM-dd hh:mm:ss")

How can I set a variable with the timestamp as a string? I am using..

PacketTs = Packet.Timestamp.ToString("yyyy-MM-dd hh:mm:ss")  

But it does not seem to work in Vb.Net

Thanks for any input you may have.. :)


Jun 21, 2012 at 12:18 PM

I have had to run 2 threads one with the capture communicator and a second with the statistics communicator.

to get the Timestamp i had to use..

PacketTs = Statistics.Timestamp

Is this the best way to do this? would the Timestamp and packet ever get out of sync if they are coming from 2 separate threads? 

Jun 22, 2012 at 12:51 AM

Hi DrDownload,

The c# statement:

Packet.Timestamp.ToString("yyyy-MM-dd hh:mm:ss");

is taking the String representation of the Timestamp field and using a ToString overload to call String.Format("yyyy-MM-dd hh:mm:ss")

That is, the cited code is not keeping a reference to the timestamp, it is just formatting the value of the property as a string.

You can get the timestamp from any packet instance like so:

(apologies if syntax is wrong, I don't do much VB) 

Dim dateValue As Date = myPacket.Timestamp

and then do whatever you need to do with the timestamp value.

You'll find a lot of information about DateTime formatting options here:





Jun 22, 2012 at 7:59 AM

Oh I see now.. Thank you. :)