<%@Page Language="C#" %>
<script runat="server">
void Page_Load(Object Sender, EventArgs e) {
DateTime Now = DateTime.Now;
int intHour = Now.Hour;
Label1.Text = "The time is now " + Now.ToString("T") + "";
if (intHour < 12) {
Label1.Text +="Good morning!";
} else if (intHour > 12 & intHour < 18) {
Label1.Text +="Good afternoon!";
} else {
Label1.Text +="Good evening!";
}
}
</script>
<html><body>
<form runat="server">
<asp:Label id="Label1" runat="server"/>
</form>
</body></html>
|