Relevant part of the code::
//that code wouldnt work ..its purpose is to compare the current time with a give time (in this case italian)
//output of current time is displayed as 0001 (time is 11:42)
//To be precise 2212 output of given time is displayed as 2213 time is 9:00....any ideas??
public static Calendar now2(int hour,int minute,int sec) {
GregorianCalend ar calendar2 = new GregorianCalend ar();
calendar2.clear ();
calendar2.set(C alendar.HOUR_OF _DAY,hour );
calendar2.set(C alendar.MINUTE, minute);
calendar2.set(C alendar.SECOND, sec);
return calendar2;
}
GregorianCalend ar calendar = new GregorianCalend ar();
calendar.clear( );
calendar.get(Ca lendar.HOUR_OF_ DAY);
calendar.get(Ca lendar.MINUTE);
calendar.get(Ca lendar.SECOND);
lanng="IT";
int openingh=-1;
int openingm=-1;
int openings=00;
int closingh=-1;
int closingm=-1;
int closings=00;
// int currentime = Integer.parseIn t(now("HHMM"));
if (langg.equalsIg noreCase("IT"))
{
openingh=9;
openingm=00;
closingm=16;
closings=00;
}
if (langg.equalsIg noreCase("IT"))
{
openingh=9;
openingm=00;
closingm=10;
closings=00;
}
if (langg.equalsIg noreCase("DA"))
{
openingh=8;
openingm=00;
closingm=15;
closings=00;
}
SimpleDateForma t format = new SimpleDateForma t("HHMM");
System.out.prin tln("To be precise " + format.format(c alendar.getTime ()));
SimpleDateForma t format2 = new SimpleDateForma t("HHMM");
System.out.prin tln("To be precise " + format2.format( now2(openingh,o peningm,opening s).getTime()));
if (choiceName.equ als("Callback") ){
if ( calendar.before (now2(openingh, openingm,openin gs)) && calendar.after( now2(closingh,c losingm,closing s )))
{
choice.setEnabl ed(false);
System.out.prin tln("Callback DISABLED");
}
else{
choice.setEnabl ed(true);}
}
//that code wouldnt work ..its purpose is to compare the current time with a give time (in this case italian)
//output of current time is displayed as 0001 (time is 11:42)
//To be precise 2212 output of given time is displayed as 2213 time is 9:00....any ideas??
public static Calendar now2(int hour,int minute,int sec) {
GregorianCalend ar calendar2 = new GregorianCalend ar();
calendar2.clear ();
calendar2.set(C alendar.HOUR_OF _DAY,hour );
calendar2.set(C alendar.MINUTE, minute);
calendar2.set(C alendar.SECOND, sec);
return calendar2;
}
GregorianCalend ar calendar = new GregorianCalend ar();
calendar.clear( );
calendar.get(Ca lendar.HOUR_OF_ DAY);
calendar.get(Ca lendar.MINUTE);
calendar.get(Ca lendar.SECOND);
lanng="IT";
int openingh=-1;
int openingm=-1;
int openings=00;
int closingh=-1;
int closingm=-1;
int closings=00;
// int currentime = Integer.parseIn t(now("HHMM"));
if (langg.equalsIg noreCase("IT"))
{
openingh=9;
openingm=00;
closingm=16;
closings=00;
}
if (langg.equalsIg noreCase("IT"))
{
openingh=9;
openingm=00;
closingm=10;
closings=00;
}
if (langg.equalsIg noreCase("DA"))
{
openingh=8;
openingm=00;
closingm=15;
closings=00;
}
SimpleDateForma t format = new SimpleDateForma t("HHMM");
System.out.prin tln("To be precise " + format.format(c alendar.getTime ()));
SimpleDateForma t format2 = new SimpleDateForma t("HHMM");
System.out.prin tln("To be precise " + format2.format( now2(openingh,o peningm,opening s).getTime()));
if (choiceName.equ als("Callback") ){
if ( calendar.before (now2(openingh, openingm,openin gs)) && calendar.after( now2(closingh,c losingm,closing s )))
{
choice.setEnabl ed(false);
System.out.prin tln("Callback DISABLED");
}
else{
choice.setEnabl ed(true);}
}
Comment