How do you get the current time of day?

后端 未结 20 2638
长发绾君心
长发绾君心 2020-11-28 18:40

How do you get the current time (not date AND time)?

Example: 5:42:12 PM

20条回答
  •  孤街浪徒
    2020-11-28 19:42

    To calculate the current datetime:

    DateTime theDate = DateTime.UtcNow;
    
    string custom = theDate.ToString("d");
    
    MessageBox.Show(custom);
    

提交回复
热议问题