Wednesday, May 5, 2010

Swelling With Headache After Birth

day, month and year of a date java Date and Calendar to read a PDF

Hi

This in an example of a Java class that can serve to no use:

DateFormat formatter = new SimpleDateFormat ("dd / MM / yyyy");
Date date = null;



try {date = formatter . parse (date);
} catch (ParseException ex) {
; Logger.getLogger (ImpuestoEstadoDeMexico.class.getName ()). log (Level.SEVERE, null, ex);}



; Date.getDay ();
date.getMonth ();
date . getYear ();

These methods are already obsolete older versions of JDK 1.1 and therefore it is recommended to use Calendar.

java.text.DateFormat import, import
java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;
import java.util.logging.Level ;
java.util.logging.Logger import;

/ **
* * @ author mew

* / public class
Date

{private String date;
private int day;
private int month;
private int anio;

    public int getAnio() {
        return anio;
    }

    public void setAnio(int anio) {
        this.anio = anio;
    }

    public int getDia() {
        return day;}


setDia public void (int day) {
this.dia = day;
;}

getFecha public String () {
return date;}


public void setFecha (String date) {

        DateFormat formatter = new SimpleDateFormat("dd/MM/yyyy");
        Date date = null;


        try {
            date = formatter.parse(fecha);
        } catch (ParseException ex) {
            Logger.getLogger(ImpuestoEstadoDeMexico.class.getName()).log(Level.SEVERE, null, ex);
        }



        Calendar calendar = Calendar.getInstance();
        calendar.setTime(date);


        int anio_ = calendar.get(Calendar.YEAR);
        int mes_ = calendar.get(Calendar.MONTH)+1;
        int dia_ = calendar.get(Calendar.DAY_OF_MONTH);

        this.setAnio(anio_);
        this.setDia (dia_)
this.setMes (Mes_)

this.fecha = date ;
} public int

Getman () {return
month

} public void
SETM (int month) {
this.mes = month;



} public static void main (String [] args) {
Date date = new Date ();
fecha.setFecha ("28/03/2010");
System.out.println (fecha.getAnio () + "" + fecha.getMes () + "" + fecha.getDia ());



}}
The salia be something like the folowing:

2010 March 1928

0 comments:

Post a Comment