Code example for GregorianCalendar

Methods: clone

0
 
    /** 
     * Initialize with the date and hour in which the specified time falls 
     */ 
    public DateAndHour(GregorianCalendar time) {
        this.time = (GregorianCalendar) time.clone();
    } 
 
    /** 
     * Initialize with the date and hour in which the specified time falls 
     */ 
    public DateAndHour(long timeInMillis) {
        this.time = new GregorianCalendar();
        this.time.setTimeInMillis(timeInMillis);
    } 
 
    /** 
     * Get the date and hour string in GMT timezone, e.g. "20110810-1300" 
     */ 
    public String getGMTDateAndHourString() {
        return DateFormatUtils.formatUTC(time.getTimeInMillis(), DATE_AND_HOUR_FORMAT);