A
A
anonymous2017-11-28 13:29:22
.NET
anonymous, 2017-11-28 13:29:22

How to convert DateTime to UNIX DateTime?

How to convert DateTime to UNIX DateTime?
And back

Answer the question

In order to leave comments, you need to log in

1 answer(s)
I
Ivan Arxont, 2017-11-28
@anonymouss

Use the function that is made for this
https://msdn.microsoft.com/ru-ru/library/system.da... DateTimeOffset.ToUnixTimeSeconds()
For example, the current time
PS: If you have a question about DateTime

DateTime foo = DateTime.Now;
long unixTime = ((DateTimeOffset)foo).ToUnixTimeSeconds();

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question