Code example for SimpleDateFormat

Methods: parse, setTimeZone

0
     * @exception ParseException if the date string cannot be parsed. 
     */ 
    public Date getAdjustedDate()
        throws ParseException 
    { 
        SimpleDateFormat dateF = new SimpleDateFormat("yyyyMMddHHmmssz");
 
        dateF.setTimeZone(new SimpleTimeZone(0, "Z"));
 
        return dateF.parse(getAdjustedTime());
    } 
 
    /** 
     * return the time - always in the form of  
     *  YYMMDDhhmmssGMT(+hh:mm|-hh:mm). 
     * <p> 
     * Normally in a certificate we would expect "Z" rather than "GMT", 
     * however adding the "GMT" means we can just use: 
     * <pre> 
     *     dateF = new SimpleDateFormat("yyMMddHHmmssz"); 
     * </pre>