12345678910111213141516171819202122232425262728293031323334 |
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- namespace Wit.SDK.Utils
- {
- /// <summary>
- /// 日期工具类
- /// </summary>
- public class DateTimeUtils
- {
- /// <summary>
- /// 获取时间戳
- /// </summary>
- /// <returns></returns>
- public static long GetTimeStamp()
- {
- TimeSpan ts = DateTime.Now - new DateTime(1970, 1, 1, 0, 0, 0, 0);
- return Convert.ToInt64(ts.TotalMilliseconds);
- }
- /// <summary>
- /// 日期格式化
- /// </summary>
- /// <param name="dateTime"></param>
- /// <param name="format"></param>
- /// <returns></returns>
- public static string Format(DateTime dateTime, string format) {
- return dateTime.ToString(format);
- }
- }
- }
|