Click here to Skip to main content
15,897,704 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
HTML
@{ 
var txt = "";
if (DateTime.Now.Hour < 11)
{ txt = "Good Morning"; }

else if (DateTime.Now.Hour > 11 && DateTime.Now.Hour < 16)
{ txt = "Good Afternoon"; }

else
{ txt = "Good Evening"; }
<p id="myp" style="text-align:center;color:greenyellow;font-size:large">@txt</p>
Posted
Updated 29-Jan-15 1:53am
v4

1 solution

Missing closing }:
XML
@{
    var txt = "";
    if (DateTime.Now.Hour < 11)
    { txt = "Good Morning"; }

    else if (DateTime.Now.Hour > 11 && DateTime.Now.Hour < 16)
    { txt = "Good Afternoon"; }

    else
    { txt = "Good Evening"; }
}
<p id="myp" style="text-align:center;color:greenyellow;font-size:large">@txt</p>
 
Share this answer
 
Comments
[no name] 8-Feb-15 3:00am    
thank u mr.peter
Peter Leow 8-Feb-15 3:02am    
You are welcome.

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