private static void fechaanno(){
DateFormat dateFormat = new SimpleDateFormat("dd/MM/yyyy");
Calendar calHoy= Calendar.getInstance();
Calendar calAyer= Calendar.getInstance();
Calendar calMannana= Calendar.getInstance();
calHoy.setTime(new Date());
int anno = calHoy.get(Calendar.YEAR);
calAyer.set(anno, 0, 1);
calMannana.set(anno, 11, 31);
System.out.println("Fecha primera: "+dateFormat.format(calAyer.getTime()));
System.out.println("Fecha hoy: "+dateFormat.format(calHoy.getTime()));
System.out.println("Fecha ultima: "+dateFormat.format(calMannana.getTime()));
}
DateFormat dateFormat = new SimpleDateFormat("dd/MM/yyyy");
Calendar calHoy= Calendar.getInstance();
Calendar calAyer= Calendar.getInstance();
Calendar calMannana= Calendar.getInstance();
calHoy.setTime(new Date());
int anno = calHoy.get(Calendar.YEAR);
calAyer.set(anno, 0, 1);
calMannana.set(anno, 11, 31);
System.out.println("Fecha primera: "+dateFormat.format(calAyer.getTime()));
System.out.println("Fecha hoy: "+dateFormat.format(calHoy.getTime()));
System.out.println("Fecha ultima: "+dateFormat.format(calMannana.getTime()));
}
No hay comentarios:
Publicar un comentario