Click here to Skip to main content
15,905,877 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
i want to do,
C#
if (time==10am)to (time==11.59am)
{
     then textbox1.text='morning'
}

how can i do this....
Posted
Updated 31-Oct-12 1:14am
v4

1 solution

You can use the DateTime struct. In DateTime.Now[^] you get the current time.
C#
if (DateTime.Now.Hour >= 10 && DateTime.Now.Hour < 12)
{
       textbox1.text = "morning";
}
 
Share this answer
 
v2
Comments
ridoy 31-Oct-12 7:15am    
+5
sumit kausalye 1-Nov-12 2:55am    
thank you sir....

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900