如果时间是凌晨12点之前,那么我该如何做呢? [英] how can i do this if time is before 12am then its morning session

查看:64
本文介绍了如果时间是凌晨12点之前,那么我该如何做呢?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想做,

if (time==10am)to (time==11.59am)
{
     then textbox1.text='morning'
}


我该怎么做....


how can i do this....

推荐答案

您可以使用DateTime结构.在 DateTime.Now [
You can use the DateTime struct. In DateTime.Now[^] you get the current time.
if (DateTime.Now.Hour >= 10 && DateTime.Now.Hour < 12)
{
       textbox1.text = "morning";
}


这篇关于如果时间是凌晨12点之前,那么我该如何做呢?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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