public static Date timestampToDate(long timestamp){
  Calendar cal=Calendar.getInstance();
  cal.set(1904,0,1,0,0,0);
  int hours=(int)(timestamp / 3600);
  int seconds=(int)(timestamp - (long)hours * 3600L);
  cal.add(Calendar.HOUR_OF_DAY,hours);
  cal.add(Calendar.SECOND,seconds);
  Date dat=cal.getTime();
  return dat;
}

public static Date timestampToDate ( long timestamp ) { Calendar cal = Calendar . getInstance ( ) ; cal . set ( 1904 , 0 , 1 , 0 , 0 , 0 ) ; int hours = ( int ) ( timestamp / 3600 ) ; int seconds = ( int ) ( timestamp - ( long ) hours * 3600L ) ; cal . add ( Calendar . HOUR_OF_DAY , hours ) ; cal . add ( Calendar . SECOND , seconds ) ; Date dat = cal . getTime ( ) ; return dat ; }
converts a macintosh - style timestamp ( seconds since january 1 , 1904 ) into a java date . the timestamp is treated as a time in the default localization . depending on that localization , there may be some variation in the exact hour of the date returned , e . g . , due to daylight savings time .
