How do you get the current time of day?

后端 未结 20 2527
长发绾君心
长发绾君心 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:26

    Try this:

    DateTime.Now.ToString("HH:mm:ss tt")

    For other formats, you can check this site: C# DateTime Format

提交回复
热议问题