using System;
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Data.SqlClient;

/// <summary>
/// CDatabase 的摘要说明
/// </summary>
namespace WEB
{
public class FUNC
{

    public FUNC()
	{
		//
		// TODO: 在此处添加构造函数逻辑
		//
	}

    public string DateDiff(DateTime DateTime1, DateTime DateTime2)
    {
        string dateDiff = null;
        try { 
            TimeSpan ts1 = new TimeSpan(DateTime1.Ticks); 
            TimeSpan ts2 = new TimeSpan(DateTime2.Ticks); 
            
            TimeSpan ts = ts1.Subtract(ts2).Duration();
            dateDiff = ts.Days.ToString() + "天" + ts.Hours.ToString() + "小时";// +ts.Minutes.ToString() + "分钟" + ts.Seconds.ToString() + "秒"; 
        }
        catch
        {
        } return dateDiff;
    }

    //产生新的文件名
    public string FileName(FileUpload FU)
    {
        DateTime dt = DateTime.Now;
        string ext = System.IO.Path.GetExtension(FU.FileName).ToLower();
        string filename = dt.Ticks.ToString();
        return filename + ext;
    }

}
}
