tijian_tieying/web/dccdc/Common/Deepleo.Weixin.SDK/Helpers/DateTimeExtension.cs
2025-02-20 12:14:39 +08:00

21 lines
556 B
C#
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Deepleo.Weixin.SDK.Helpers
{
public static class DateTimeExtension
{
/// <summary>
/// 将Datetime转换成时间戳1970-1-1 00:00:00至target的总秒数
/// </summary>
/// <param name="target"></param>
/// <returns></returns>
public static long ToTimestamp(this DateTime target)
{
return (target.ToUniversalTime().Ticks - 621355968000000000) / 10000000;
}
}
}