Rabu, 13 April 2011

Membuat Kalender dengan java

import java.util.Date;
import java.util.Calendar;
import java.util.GregorianCalendar;

public class Kalender {

private static final int[] jml_hari = {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 };
public Kalender(){
Calendar cal = Calendar.getInstance();
int thn = cal.get(Calendar.YEAR);
int bln = cal.get(Calendar.MONTH);

GregorianCalendar gCal = new GregorianCalendar (thn, bln, 1);

System.out.printf("%tB %<=dMonth; i++){
if(i<=9){
System.out.print(" ");
}
System.out.print(i);
if ((blank + i) % 7==0){
System.out.println();
} else{
System.out.print(" ");
}
}
System.out.println("----------------------");
}
public static void main (String[] args){
new Kalender();
}


}

1 komentar: