using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace CommonNetwork_ICE.Util
{
    /// <summary>
    /// 日期工具类
    /// </summary>
    public class DateUtil
    {
        public const string DEFAULT_PATTERN = "yyyy-MM-dd HH:mm:ss.fff";

        /// <summary>
        /// 得到指定格式的日期类,参数为空返回默认格式
        /// </summary>
        /// <param name="pattern">指定格式</param>
        /// <returns></returns>
        public static string getStrOfCurrDate(String pattern)
        {
            DateTime date = DateTime.Now;
            if (pattern == null)
            {
                return date.ToString(DEFAULT_PATTERN);
            }
            return date.ToString(pattern);
        }
    }
}