<%@ page import="diamondedge.asp.*,diamondedge.util.*,diamondedge.ado.*" %>
<%!
%>
<%
java.util.Date varDate = DateTime.EmptyDate;
Asp.init( request, response, out );
%>
<HTML>
<HEAD>
<TITLE>Conditional Operator Sample</TITLE>
</HEAD>
<BODY BGCOLOR="White" topmargin="10" leftmargin="10">
<!-- Display Header -->
<font size="4" face="Arial, Helvetica">
<b>Conditional Operator Sample</b></font><br>
<hr size="1" color="#000000">
<!-- If...Then example -->
<%
varDate = DateTime.now();
%>
<P>The date is: <%= varDate %></p>
<%
// Select Case statement to display a message based on the day of the month
if( DateTime.day( varDate ) == 1 || DateTime.day( varDate ) == 2 || DateTime.day( varDate ) == 3 || DateTime.day( varDate ) == 4 || DateTime.day( varDate ) == 5 || DateTime.day( varDate ) == 6 || DateTime.day( varDate ) == 7 || DateTime.day( varDate ) == 8 || DateTime.day( varDate ) == 9 || DateTime.day( varDate ) == 10 )
{
out.print( "<P>It's the beginning of the month.</P>" );
}
else if( DateTime.day( varDate ) == 11 || DateTime.day( varDate ) == 12 || DateTime.day( varDate ) == 13 || DateTime.day( varDate ) == 14 || DateTime.day( varDate ) == 15 || DateTime.day( varDate ) == 16 || DateTime.day( varDate ) == 17 || DateTime.day( varDate ) == 18 || DateTime.day( varDate ) == 19 || DateTime.day( varDate ) == 20 )
{
out.print( "<P>It's the middle of the month.</P>" );
}
else
{
out.print( "<P>It's the end of the month.</P>" );
}
%>
<P>The time is: <%= DateTime.now() %></P>
<%
// Check for AM/PM, and output appropriate message
if( Strings.right( DateTime.format( DateTime.now() ), 2 ).equals( "AM" ) )
{
out.print( "<P>Good Morning</p>" );
}
else
{
out.print( "<P>Good Evening</p>" );
}
%>
</BODY>
</HTML>