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 482B

123456789101112131415161718192021
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6. namespace Teknik.Utilities
  7. {
  8. public static class DateTimeHelper
  9. {
  10. public static int GetUnixTimestamp()
  11. {
  12. return DateTime.UtcNow.GetUnixTimestamp();
  13. }
  14. public static int GetUnixTimestamp(this DateTime dt)
  15. {
  16. return (int)(dt.Subtract(new DateTime(1970, 1, 1))).TotalSeconds;
  17. }
  18. }
  19. }