static void Main(string[] args)
{
DateTime startTime = DateTime.Now;
string userName = "用户a";
string setInfo = "当前的访问者是:" + userName;
DateTime endTime = DateTime.Now;
TimeSpan midTime = endTime - startTime;
string requireTime = string.Format(",当前请求的时间是:{0}小时{1}分{2}秒{3}毫秒!", midTime.Hours, midTime.Minutes, midTime.Seconds, midTime.Milliseconds);
Console.WriteLine(setInfo + requireTime);
Console.Read();
}
时间: 2024-10-14 10:28:16