Sometimes we could need to get the UNIX time stamp, as you may know, that number is the amount of seconds since 1-1-1970 until now.
If you want to get the same number using .NET framework, you can do something like:
We’re simply subtracting dates, Now – 1/1/1970
Then, we can get the totalSeconds:
But wait!, if you render this now.
You´ll maybe obtain a floating point number, this is because DateTime.Now is a very precise object, but maybe we will not need that, so, we can do it like this:
Do some test, and do it in the way it fit your needs.