24 lines
561 B
C#
24 lines
561 B
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
|
|
namespace skyscraper5.Skyscraper
|
|
{
|
|
public static class DateTimeExtensions
|
|
{
|
|
public static long ToUnixTime(this DateTime dt)
|
|
{
|
|
double totalSeconds = dt.Subtract(new DateTime(1970, 1, 1)).TotalSeconds;
|
|
long tv = (long)totalSeconds;
|
|
return tv;
|
|
}
|
|
|
|
public static long ToJavaMillis(this DateTime dt)
|
|
{
|
|
return ToUnixTime(dt) * 1000;
|
|
}
|
|
}
|
|
}
|