Hi,

 you need to create a class InvalidateException that extends from Exception
with some constructors.

> -----Original Message-----
> From: vijay [SMTP:[EMAIL PROTECTED]]
> Sent: Thursday, May 16, 2002 11:14 AM
> To:   [EMAIL PROTECTED]
> Subject:      Re: date service contd
>
> hi,
>
>     i tried to compile the program.. but iam getting the following error..
>
> D:\TestJavaPrograms\DateService.java:47: cannot resolve symbol
> symbol  : class InvalidDateException
> location: class DateService
>  public static String format(Date date, String simpleFormat) throws
> InvalidDateException
>
> ^
> 1 error
>
> thanks & regards
> vijayanand.R
>
>     (),,,()
>    ( (.  .)     .-''''''''''-.
>   (    o  ) ) (    'o'   )
> =(,,)=(,,)=(,,)==(,,)=
> ----- Original Message -----
> From: "Kesav, Ramesh" <[EMAIL PROTECTED]>
> To: <[EMAIL PROTECTED]>
> Sent: Wednesday, May 15, 2002 4:39 PM
> Subject: date service contd
>
>
> public final static java.util.Date getTime(int hours, int min, int sec)
>     throws InvalidDateException {
>     try {
>         Calendar cal = Calendar.getInstance(); java.util.Date today =
> cal.getTime();
>         int year = getYear(today); int month = getMonth(today) - 1;
>         int date = getDay(today); cal.clear();
>         cal.set(year, month, date, hours, min, sec);
>         return cal.getTime();
>     } catch (Exception e) {
>         if (e instanceof InvalidDateException)
>             throw (InvalidDateException) e;
>         else {
>             String input = "" + hours + ':' + min + ':'+ sec;
>         }
>     }
> }
> public final static java.util.Date getTime(int year,int month,int day,int
> hours,int min,intsec)
>     throws InvalidDateException {
>     try {
>         Calendar cal = Calendar.getInstance();       cal.clear();
>         cal.set(year, month-1, day, hours, min, sec);   return
> cal.getTime();
>     } catch (Exception e) {
>         if (e instanceof InvalidDateException)
>             throw (InvalidDateException) e;
>         else {
>             String input = "" + hours + ':' + min + ':' + sec;
>         }
>     }
>
> }
> public static String getXML(Date date) throws InvalidDateException{
>         return getXML(date, "Year", "Month", "Day");
> }
> public static String getXML(Date date, String yearTag, String monthTag,
> String dayTag) throws InvalidDateException{
>         try {
>                 Calendar cal = Calendar.getInstance();cal.clear();
>                 cal.setTime(date);StringBuffer buffer = new
> StringBuffer(41);
>                  buffer.append("<");
> buffer.append(yearTag);buffer.append(">");
>
> buffer.append(cal.get(cal.YEAR));buffer.append("</");buffer.append(yearTag
> );
>
> buffer.append(">");buffer.append("<");buffer.append(monthTag);
>                 buffer.append(">");buffer.append(cal.get(cal.MONTH) +
> 1);buffer.append("</");
>
> buffer.append(monthTag);buffer.append(">");buffer.append("<");buffer.appen
> d(
> dayTag);
>
> buffer.append(">");buffer.append(cal.get(cal.DATE));buffer.append("</");
>             buffer.append(dayTag);buffer.append(">");return
> buffer.toString();
>         } catch (Exception e) {}
> }
>  public static int getYear(Date date) throws InvalidDateException{
>         try {
>                 Calendar cal = Calendar.getInstance();cal.clear();
>                 cal.setTime(date);int yy = cal.get(Calendar.YEAR);
>                 if (yy < 100)
>                         yy += 1900;
>                 return yy;
>         } catch (Exception e) { }
> }
> public static boolean isSameDay(Date date1, Date date2) {
>         if ( date1 == null && date2 == null ){
>                 return true;
>         }
>         if ( date1 == null || date2 == null ){
>                 return false;
>         }
>     Calendar cal1 = Calendar.getInstance();   cal1.setTime(date1);
>     Calendar cal2 = Calendar.getInstance();   cal2.setTime(date2);
>     return (cal1.get(Calendar.DAY_OF_MONTH) ==
> cal2.get(Calendar.DAY_OF_MONTH)
>         && cal1.get(Calendar.MONTH) == cal2.get(Calendar.MONTH)
>         && cal1.get(Calendar.YEAR) == cal2.get(Calendar.YEAR));
> }
>    public static Date parse( String date, String simpleFormat ) throws
> InvalidDateException
>    {
>       try
>       {
>                 return new SimpleDateFormat(simpleFormat).parse(date);
>       }
>       catch ( Exception e )
>       { }
>    }
> public static Date toStandardDate(String date) throws
> InvalidDateException{
>         try{
>                 return dateFormatter.parse(date);
>         } catch (Exception e){}
> }
> public static Date toStandardDateTime(String date) throws
> InvalidDateException{
>         try{
>                 return dateTimeFormatter.parse(date);
>         } catch (Exception e){  }
> }
> public static String toStandardString(Date date) throws
> InvalidDateException{
>         try{
>                 return dateFormatter.format(date);
>         } catch (Exception e){}
> }
> public static String toStandardTimeString(Date date) throws
> InvalidDateException{
>         try{
>                 return dateTimeFormatter.format(date);
>         } catch (Exception e){}
> }
> }
>
>
> Regards
>
> Ramesh Kesavanarayanan
> [EMAIL PROTECTED]
>
> ==========================================================================
> =
> To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff
> JSP-INTEREST".
> For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST
> DIGEST".
> Some relevant FAQs on JSP/Servlets can be found at:
>
>  http://archives.java.sun.com/jsp-interest.html
>  http://java.sun.com/products/jsp/faq.html
>  http://www.esperanto.org.nz/jsp/jspfaq.jsp
>  http://www.jguru.com/faq/index.jsp
>  http://www.jspinsider.com
>
> ==========================================================================
> =
> To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff
> JSP-INTEREST".
> For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST
> DIGEST".
> Some relevant FAQs on JSP/Servlets can be found at:
>
>  http://archives.java.sun.com/jsp-interest.html
>  http://java.sun.com/products/jsp/faq.html
>  http://www.esperanto.org.nz/jsp/jspfaq.jsp
>  http://www.jguru.com/faq/index.jsp
>  http://www.jspinsider.com

===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST DIGEST".
Some relevant FAQs on JSP/Servlets can be found at:

 http://archives.java.sun.com/jsp-interest.html
 http://java.sun.com/products/jsp/faq.html
 http://www.esperanto.org.nz/jsp/jspfaq.jsp
 http://www.jguru.com/faq/index.jsp
 http://www.jspinsider.com

Reply via email to