Esempio n. 1
0
    /// <summary>
    /// 获取格式化后的时间格式
    /// </summary>
    /// <param name="timeStamp">10位时间戳(不填默认当前时间戳)</param>
    public static string getFormatTime(long timeStamp = -1)
    {
        DateTime dateTime = new DateTime();

        if (timeStamp == -1)
        {
            // 当前时间(10wei)
            timeStamp = DateTool.GetNowTime();
            dateTime  = UnixToDataTime(timeStamp);
        }
        else
        {
            // 指定的时间
            dateTime = DateTool.UnixToDataTime(timeStamp);
        }
        return(dateTime.ToString("yyyy-MM-dd HH:mm:ss"));
    }