public Time(Date date){
  SimpleTimeZone tz=new SimpleTimeZone(0,"Z");
  SimpleDateFormat dateF=new SimpleDateFormat("yyyyMMddHHmmss");
  dateF.setTimeZone(tz);
  String d=dateF.format(date) + "Z";
  int year=Integer.parseInt(d.substring(0,4));
  if (year < 1950 || year > 2049) {
    time=new DERGeneralizedTime(d);
  }
 else {
    time=new DERUTCTime(d.substring(2));
  }
}

public Time ( Date date ) { SimpleTimeZone tz = new SimpleTimeZone ( 0 , "Z" ) ; SimpleDateFormat dateF = new SimpleDateFormat ( "yyyyMMddHHmmss" ) ; dateF . setTimeZone ( tz ) ; String d = dateF . format ( date ) + "Z" ; int year = Integer . parseInt ( d . substring ( 0 , 4 ) ) ; if ( year < 1950 || year > 2049 ) { time = new DERGeneralizedTime ( d ) ; } else { time = new DERUTCTime ( d . substring ( 2 ) ) ; } }
creates a time object from a given date - if the date is between 1950 and 2049 a utctime object is generated , otherwise a generalizedtime is used .
