Convertir la date en une valeur de type long

Author:

Convertir,la,date,à,une,valeur,de,type,long
{filelink=5598}


import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.Date;

public class DateEnLong {
  public static void main(String[] args) throws Exception
  {
    String aujourdhui = "11/09/2007";

    DateFormat format = new SimpleDateFormat("dd/MM/yyyy");
    Date date = format.parse(aujourdhui);
    long dateEnLong = date.getTime();

    System.out.println("Date = " + date);
    System.out.println("Répresentation En Long = " + dateEnLong);
  }
}

/*
 Date = Tue Sep 11 00:00:00 WAT 2007
 Répresentation En Long = 1189465200000
 */

Leave a Reply

Your email address will not be published. Required fields are marked *