I needed to convert now (datetime) to UNIX Time (number of seconds or milliseconds since jan 1, 1970) using C#.

I was able to use this little code to do the conversion.

Convert Time to UNIX Time in C#DateTime dt70 = new DateTime( 1970110000 );
Convert Time to UNIX Time in C#
long ticks1970 = dt70.Ticks;
Convert Time to UNIX Time in C#
int gmt = (int) ((DateTime.UtcNow.Ticks - ticks1970 ) / 10000000L); 

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-01-02
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2019-07-20
猜你喜欢
  • 2021-06-09
  • 2022-12-23
  • 2022-12-23
  • 2022-01-23
相关资源
相似解决方案