Re: How to inc a date using java.util.calender or java.util.date

K R Viju <[email protected]>
Newsgroups gmane.comp.java.sun.servlet
Message-ID <[email protected]>
Andy,
Since DATE, MONTH, YEAR are static, you should use Calender.DATE,
Calender.MONTH, Calender.YEAR
But since u have used calendarFrom.DATE etc, it warns you, thou its not an
error,..

Viju

----- Original Message -----
From: "Andy Susanto" <[email protected]>
To: <[email protected]>
Sent: Monday, August 02, 2004 3:22 PM
Subject: Re: How to inc a date using java.util.calender or java.util.date


> Viju,
>
> thanks for your code, but when i check eclipse show warning that warning
> sound like this
> "the static field Calender.DATE should be accessed in static way"
> "the static field Calender.MONTH should be accessed in static way"
> "the static field Calender.YEAR should be accessed in static way"
>
> is that oke is warning error appear ?
>
> this my code:
>
>          int thn = Integer.parseInt(PrintDataFrom.substring(0,4));
>         int bln = Integer.parseInt(PrintDataFrom.substring(5,7));
>         int tgl = Integer.parseInt(PrintDataFrom.substring(8,10));
>         Calendar calendarFrom = new GregorianCalendar(thn,bln,tgl);
>
>         thn = Integer.parseInt(PrintDataTo.substring(0,4));
>         bln = Integer.parseInt(PrintDataTo.substring(5,7));
>         tgl = Integer.parseInt(PrintDataTo.substring(8,10));
>         Calendar calendarTo = new GregorianCalendar(thn,bln,tgl);
>
>         StringBuffer sbHasil = new StringBuffer("Total Transaksi yang di
dapat
> ").append(TotalTransaksi);
>         sbHasil.append("Total Max Transaksi yang diinginkan
> ").append(MaxTotalBilling).append(NewLine.HTMLBreak(1));
>         sbHasil.append("Dari
>
").append(calendarFrom.get(calendarFrom.DATE)).append("-").append(calendarFr
om.get(calendarFrom.MONTH)).append("-").append(calendarFrom.get(calendarFrom
.YEAR)).append("Sampai
>
").append(calendarTo.get(calendarTo.DATE)).append(calendarFrom.get(calendarF
rom.MONTH)).append(calendarFrom.get(calendarFrom.YEAR)).append(NewLine.HTMLB
reak(1));
>
>     int test =  calendarTo.get(calendarTo.DAY_OF_YEAR) -
> calendarFrom.get(calendarFrom.DAY_OF_YEAR);
>
>         sbHasil.append(test);
>         int i = 1;
>         while(i <= test){
>                 calendarFrom.add(calendarFrom.DATE,1);
>                 i++;
>           sbHasil.append("Rentang
>
Waktu").append(calendarFrom.get(calendarFrom.DATE)).append("-").append(calen
darFrom.get(calendarFrom.MONTH)).append("-").append(calendarFrom.get(calenda
rFrom.YEAR)).append(NewLine.CodeBreak());
>         }
>
>
> >     if you want all dates btwn start and end date, hope this code
works..
> >
> >     do{
> >     System.out.println(START_DATE);
> >      START_DATE.add(Calendar.DATE, 1);
> >      flag = START_DATE.before(END_DATE) ||START_DATE.equals(END_DATE);
> >     }
> >     while(flag);
> >
> > Viju
> >
> >
>
>
___________________________________________________________________________
> To unsubscribe, send email to [email protected] and include in the
body
> of the message "signoff SERVLET-INTEREST".
>
> Archives: http://archives.java.sun.com/archives/servlet-interest.html
> Resources: http://java.sun.com/products/servlet/external-resources.html
> LISTSERV Help: http://www.lsoft.com/manuals/user/user.html

___________________________________________________________________________
To unsubscribe, send email to [email protected] and include in the body
of the message "signoff SERVLET-INTEREST".

Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.