你如何一天的当前时间? [英] How do you get the current time of day?

查看:81
本文介绍了你如何一天的当前时间?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你如何获得当前时间(没有日期和时间)?

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

例如:下午5时42分12秒。

Example: 5:42:12 PM

推荐答案

DateTime.Now.TimeOfDay 给它给你作为一个时间跨度(午夜)。

DateTime.Now.TimeOfDay gives it to you as a TimeSpan (from midnight).

DateTime.Now.ToString(H:MM:SS TT)。给它给你一个的字符串

日期时间参考:<一href=\"https://msdn.microsoft.com/en-us/library/system.datetime\">https://msdn.microsoft.com/en-us/library/system.datetime

这篇关于你如何一天的当前时间?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆