将AM和PM附加到用于时间控制的标签上 [英] Appending AM and PM to a label forTime Control

查看:159
本文介绍了将AM和PM附加到用于时间控制的标签上的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

早安,

我有一个带有工具条标签的状态栏.

我正在努力在页面底部显示时间,这已经完成了.
我的问题是根据时间显示上午和下午.

Windows应用程序,C#.

希望您了解了.

请回复

--- Narendra

Hi GoodMorning,

I have a statusbar which has toolstriplabels.

I am working to show time at bottom of my page, which I have done.
My problem is to show AM and PM based on time.

Windows applications,C#.

Hope you Understood.

Please reply

---Narendra

推荐答案

以下是显示时间的AM和PM的几种方法:

1.使用LongTime格式:
Here are a couple ways to show AM and PM with your time:

1. Use the LongTime format:
toolstriplabel1.Text = DateTime.Now.ToLongTimeString();



2.使用自定义格式 [



2. Use a custom format [^] to specify a 12-hour time:

toolstriplabel1.Text = DateTime.Now.ToString("hh:mm tt");


这篇关于将AM和PM附加到用于时间控制的标签上的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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