The next generation of the Teknik Services. Written in ASP.NET. https://www.teknik.io/
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

DateTimeHelper.cs 380B

1234567891011121314151617
  1. using System;
  2. namespace Teknik.Utilities
  3. {
  4. public static class DateTimeHelper
  5. {
  6. public static int GetUnixTimestamp()
  7. {
  8. return DateTime.UtcNow.GetUnixTimestamp();
  9. }
  10. public static int GetUnixTimestamp(this DateTime dt)
  11. {
  12. return (int)(dt.Subtract(new DateTime(1970, 1, 1))).TotalSeconds;
  13. }
  14. }
  15. }