From 488efb508eb0648773fe7b68e810e04bcd7ca075 Mon Sep 17 00:00:00 2001 From: wei <kaede@kaededeMacBook-Air.local> Date: 星期五, 11 十二月 2020 15:58:15 +0800 Subject: [PATCH] 20201211 --- HDL_ON/Common/Utlis.cs | 21 +++++++++++++++++++++ 1 files changed, 21 insertions(+), 0 deletions(-) diff --git a/HDL_ON/Common/Utlis.cs b/HDL_ON/Common/Utlis.cs index 6283094..906212b 100644 --- a/HDL_ON/Common/Utlis.cs +++ b/HDL_ON/Common/Utlis.cs @@ -2,6 +2,8 @@ using Shared; using System.Text.RegularExpressions; using System.Text; +using System.Collections.Generic; +using System.Collections; namespace HDL_ON { @@ -303,6 +305,24 @@ } /// <summary> + /// + /// </summary> + /// <param name="isMilliseconds">鏄惁寰</param> + /// <returns></returns> + public static string GetTimestamp(bool isMilliseconds = true) + { + System.DateTime startTime = TimeZone.CurrentTimeZone.ToLocalTime(new System.DateTime(1970, 1, 1)); // 褰撳湴鏃跺尯 + if (isMilliseconds) + { + return ((long)(DateTime.Now - startTime).TotalMilliseconds).ToString(); // 鐩稿樊寰鏁� + } + else + { + return ((long)(DateTime.Now - startTime).TotalSeconds).ToString(); // 鐩稿樊绉掓暟 + } + } + + /// <summary> /// 鑾峰彇璇锋眰鎻愪氦鐨勮瑷�鍙傛暟 /// </summary> public static string GetPostLanguageType() @@ -313,4 +333,5 @@ } + } -- Gitblit v1.8.0