将两个时间组合,结果为2015年4月8日-4月10日

时间 2015-04-08 00:00:00

       2015-04-10 00:00:00

//格式化时间
    protected string Time(string id)
    {
        string text = "";
        DataTable dt = DB.GetDataTable("s_start,s_end", "huodong", "i_state = 1 and i_id=" + id, "");
        if (dt.Rows.Count > 0)
        {
            DateTime tt = Convert.ToDateTime(dt.Rows[0][0].ToString());
            DateTime dd = Convert.ToDateTime(dt.Rows[0][1].ToString());
            text = tt.GetDateTimeFormats('D')[0].ToString() + "-" + dd.GetDateTimeFormats('M')[0].ToString();
        }
        return text;

    }

原文地址:https://www.cnblogs.com/candyzhmm/p/4316501.html