Share on Google+Share on Google+

alak
web programming
1 Answer(s)      7 years ago
Posted in : JSP-Servlet

Ads

View Answers

November 20, 2009 at 5:24 PM


Hi Friend,

Try the following code:

<[email protected] contentType="text/html" import="java.util.*" %>
<[email protected] import="java.text.*" %>


<html>
<body>
<p>&nbsp;</p>
<div align="center">
<center>
<table border="0" cellpadding="0" cellspacing
="0" width="460" bgcolor="EEFFCA">

<tr>
<td width="100%"><font size="6" color="008000">&nbsp;Date Example</font></td>

</tr>
<tr>
<td width="100%"><b>&nbsp;Time is:&nbsp; <font color="FF0000">
<%
Date date = new Date();
String strDateFormat = "HH:mm:ss a";
SimpleDateFormat sdf = new SimpleDateFormat(strDateFormat);
out.println(sdf.format(date));
%>
</font></b></td>
</tr>
</table>
</center>
</div>
<center>
<h1>
<%
String st=sdf.format(date);
char ch=st.charAt(9);
System.out.println(ch);
String ss=st.substring(0,2);
System.out.println(ss);
int t=Integer.parseInt(ss);
if((t>17)&&(ch=='P')||(ch=='p')){
out.println("Good Evening");
}
else if((t>12)&&(t>17)&&(ch=='P')||(ch=='p')){
out.println("Good Afternoon");
}
else{
out.println("Good Morning");
}
%>
</h1>
</center>
</body>
</html>

Thanks









Related Tutorials/Questions & Answers:
web programming
web programming  what is best choice java or .net for web applications
web programming
web programming  what is best choice java or .net for web applications
Advertisements
Web programming
Web programming  Write a program in servlet by using JDBC to display the records of employees from a table called employee
Web programming guidence - Applet
Web programming guidence  Dear Sir/Madam, I have studied (little) Java but not having good knowledge. I wish to host a simple web site. For which I am trying to make a web design. I could make simple web design
web programming - JSP-Servlet
web programming   Write a JSP page to display the number of hits to this page. (Hint: use application scope of java bean).  Hi Friend, Please visit the following link: http://www.roseindia.net/jsp/simple-jsp
web programming - JSP-Servlet
web programming  9)Create an HTML page containing the following features a.Create a login JSP page with username , password and submit button. b.On submit, display message ?Thank you for logging in ? Also create cookies
web programming - JSP-Servlet
web programming  Write a JSP program to display current date and time and suitable welcome message. 1.If time is between 5AM and 12 PM display welcome message as ?Good Morning? 2.If time is between 12 PM and 5 PM display
web programming - JSP-Servlet
web programming  6) Create an HTML page containing the following features a.A combo box containing the list of 7 colors: Violet, Indigo, Blue, Green, Yellow, Orange, Red b.An empty 1X1 table with default background color
web programming - Java Beginners
web programming  4) Create two HTML pages a. First page with the following features i. An image(logo) with a company name as the heading in the top center ii. This page containing an HTML form, two text boxes to get First Name
web
web  what do you mean by stacking elements? explain with example(in web programming
web
web  what do you mean by stacking elements? explain with example(in web programming
Programming
Programming  Given a number n, write a programming to determine its square root if it is possible, in the contraly case print an appropriate massege on the screen
programming
Java Constructor programming for single and double constructor  write a program which have no argument constructor ,single parameter constructor constructor,double parameter constor,and the now when we create a object
New to Java programming
is a programming language which you can use to develop the Desktop, web , Mobile... Programming Multithread Programming Java Applets Java Web Applications... Programming in Java Web Application Development After learning
Unix Web Hosting
Unix Web Hosting Unix Web Hosting is the type hosting provided on the Unix Servers. Unix Web Hosting is very reliable hosting option. Unix Hosting provides Perl programming, PHP programming and MySQL & PostgreSQL databases
Ajax programming
concept. What should be my starting point for Ajax programming? Thanks   Hi, If you have prior programming experience in any web development...Ajax programming  Hi, How I can start ajax programming easily? I
programming questions
programming questions  this is my assignment questions please help me... the programs in c# language Describe the following with respect to creating Web Forms in .Net environment: a. Web Form Life Cycle b. Creating a Web Form
Java Programming Language
Java Programming Language  Hi, For beginner which programming concepts is important? Discuss the importance of Java programming language. In the discussion please let's know how to use Java in developing web applications
network programming
network programming   Tutorial for Network programming and administration
Programming with JSP
Programming with JSP  Who will post me the answer
Java Programming
Java Programming  Hi, What is Java Programming? How I can learn Java Programming in one month? Thanks
ajax programming
Ajax Programming What is Ajax Programming? Asynchronous JavaScript and XML... the section of the web page without reloading the whole page. This is the technique to creating faster web pages which is also more integrative. This technique
Programming with JSP
Programming with JSP  Write a program using jsp that accepts a course code as input and displays the course title the program to which it belongs
Programming (general)
Programming (general)  I haven't yet started college/university but I'm interested in studying programming. I wondering if programming is difficult or confusing with all the codes you have to learn? Also how many languages would
programming concept
programming concept  Write a program that allows the user to input a total dollar amount for an online shopping order and computes and outputs the shipping cost based on the following schedule
programming of foxpro
programming of foxpro  hello sir , sir i am use the foxpro . but i know about c . sir how can i learn fox pro . i know about something about foxpro
socket programming
socket programming  how to create server socket in web service...it will read parameter from file
C Programming
C Programming  hi,how can i write a program in C programming to place reservation in air plane from the menu let the user to inter his/her gender(W or M)and draw seats by using ascii codes and choose where he/she will sit
Socket Programming
Socket Programming  How to connect a computer through IP only and check whether it is up and running? I can't see any method in Socket programming where I can pass only IP address as argument. I need the pass port number also
programming error
programming error  I got an error when i did the following program the prg. is to "select the name from database when the age is given for the respective name" error i got is:SQL exception please give me the solution by providing
Tutorials   
Java Spring Hibernate Struts Training fat image from db fat image from db fat image from db fat image from db unable to get value returned from javascript variable in page How to change image size before adding to mysql using jsp Design a registration.jsp page with input for user registration details Cart Quantity jsp servlet coding issue servlet,jsp login registration forms without database in ecalipse ide using hashmap to store the registraion details ? servlet,jsp login registration forms without database in ecalipse ide using hashmap to store the registraion details ? servlet,jsp login registration forms without database in ecalipse ide using hashmap to store the registraion details ? servlet,jsp login registration forms without database in ecalipse ide using hashmap to store the registraion details ? servlet,jsp login registration forms without database in ecalipse ide using hashmap to store the registraion details ? servlet,jsp login registration forms without database in ecalipse ide using hashmap to store the registraion details ? servlet,jsp login registration forms without database in ecalipse ide using hashmap to store the registraion details ? image pdf marking pdf marking Multiple image upload using JSP Read code from excel sheet and upload into database using JSP Student java about search engine Convert BLOB to PDF and save it to a location how to copy files from remote to local machine using SFTP SSL in java? Like Team viewer Socket and Servert -Jsp how to copy files from remote location to local using java? How To Store Multilple Images In MySQL database dynamically with image uploader and then retrieve them in image gallery using java how to create SOAP based web service in java? how to fetch data from mysql database table and draw a bar chart on that data using in jsp how to create users in LDAP using java? how to authenticate user using TIVOLI api in java? how to create users using IBM Tivoi API in jsp/servelet? Java/J2ee Please explain this code as many packages and classes are unknown to me .! how to download the uploaded folder files using jsp Login Query image is display from path of mysql database please reply the code to store dynamic fields in database? Reloading issue in jsp How to get Button Id ? calling one jap page from another jsp page login login Problem to get connection from DAO class to JDBC Page Loading Time Fix table's column's name row(1st row of the table) so that it does not move up when the table is scrolled up to view more rows below Sending hidden values

Ads

 
Advertisement null

Ads