Computer problems,Computer help
*AX SOFT>>>Programming & Design

I got the system time using java.sql.time package,i want time before 12:00 O'clock print good morning how?


this is my java code:plz send urgently

<%@ page import="java.sql.*;" %>
<%@ page import="java.io.*;" %>

<%! public static java.sql.Time getCurrentJavaSqlTime()
{
java.util.Date date = new java.util.Date();
return new java.sql.Time(date.getTime());
}
%>
<%
java.sql.Time time = getCurrentJavaSqlTime() ;
out.println("now time is"+time);
if(time > 1 && time < 12)
{
out.println("good morning");
}
else if(time>12 && time<4)
{
out.println("good afternoon");
}
else
{
out.println("good evening");
}
%>

Here's a start.

package com.yahoo.answers;

import java.util.Date;

public class GoodDay {

public static void main(String[] args) {
Date now = new Date();
int hours = now.getHours();
System.out.println("hours = " + hours);
}
}

i compiled above program but error came,error is getHour() in java.util.Date has been deprecated,
int hours = now.getHours(); error came at .getHours() Report It

thank you i got a answer but one problem suppose time is 12:30pm still say good morning,i want miniutes also calculated. Report It

Are you using JSP? I'm using plain Java. Report It

Tags
  General - Computers & Internet   Software   Security   Programming & Design   Facebook   Flickr   Google   MSN   MySpace
Related information
  • Visual Basic???

    Where are you inserting the code that you just showed us > MsgBox("Unable to Perform Function.",0,"Error") IT has to be in the OnClick Event of the Button on the form. ...

  • What is a .reg file?

    hi, try this link to download .reg file.. ...

  • CSS: link code help!?

    You forgot to close your <a> tag. <a href= "aboutme-mock-up-CSS.html"> about me </a></div>

    ...
  • How can i put an affilite choice in my website?

    You need a website with database support. Normally these kind of websites uses PHP and MySQL so you can go for Linux hosting. Try www.hostgator.com its a good one.. I am using the same service...

  • Complicated document.write question in javascript?

    The problem occurs with how you are using the variable "sld". When the link is written out, it actually writes out "id2" so Javascript thinks that it is a variable; which doesn...

  • Which code represents character data boxes and graphical symbols?

    Most English-only programs get by fine with ASCII but if you need to support non-English text you will want to take a look at Unicode. I don't think EBCDIC is used anywhere anymore. Progra...

  • VbScript - Help Me!?

    hi, use this coding: <script language="vbscript"> dim n(2) for i=0 to 2 n(i)=cint(inputbox("Enter 3 numbers")) next if n(0)<n(1) and n(0)<n(2) then if n(0...

  • Can we move files accross a unix filesystem?explain ur answer .?

    Yes, you can move files across UNIX file systems - If you move files with in a file system, the same inode number is maintained and works more as a rename - When you move files across file syst...

  •  

    Categories--Copyright/IP Policy--Contact Webmaster