conversion timestamp en format normal
j'ai un petit souci pour la conversion d'un timestamp unix en format date normal.
Code:
1 2 3 4 5 6 7
|
public static void main(String[] args) {
long timeMillis = 878542459 ;
Date d = new Date((long)timeMillis);
SimpleDateFormat formatter = new SimpleDateFormat("yyyyMMdd hhmmss");
System.out.println(formatter.format(d));
} |
j'ai testé ce code pour un timestamp unix de format"1133883835267", il marche bien, par contre pour le timestamp dans le code, il m'affiche tout le temps 19701101.
qqu aurait une idée?
Merci.