Console C#中的当前时间,但随着系统时间的变化而不断变化

时间:2013-06-04 12:04:50

标签: c# date console-application

与此主题一样:How to display updated time as system time on a label using c#?

我想在控制台应用中使用相同的解决方案...... Datetime类只显示系统的当前时间,但不会随着系统时间的变化而改变。 有可能吗?

1 个答案:

答案 0 :(得分:2)

您必须清除控制台并将新内容写入控制台。

while(true)
{

    Console.Clear();
    Console.WriteLine(DeteTime.Now);
    Thread.Sleep(1000);

}