Java Time Add addTime(Date date, String time)

Here you can find the source of addTime(Date date, String time)

Description

Deprecated!

License

Open Source License

Parameter

Parameter Description
date a parameter
time a parameter

Declaration

@Deprecated
public static Date addTime(Date date, String time) 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

import java.util.Calendar;

import java.util.Date;
import java.util.GregorianCalendar;

public class Main {
    /**// www.j  a  v  a 2  s .co  m
     * Deprecated!
     * 
     * @param date
     * @param time
     * @return
     */
    @Deprecated
    public static Date addTime(Date date, String time) {
        // TODO: Bu method ortak sinif'a gore duzenlenecek
        int hour = Integer.parseInt(time.substring(0, 2));
        int minute = Integer.parseInt(time.substring(2, 4));
        int second = Integer.parseInt(time.substring(4, 6));
        GregorianCalendar calendar = new GregorianCalendar();
        calendar.setTime(date);
        calendar.set(Calendar.HOUR, hour);
        calendar.set(Calendar.MINUTE, minute);
        calendar.set(Calendar.SECOND, second);
        return calendar.getTime();
    }
}

Related

  1. addTime(Date current, Date toadd)
  2. addTime(Date date, Date addTime)
  3. addTime(Date date, int field, int value)
  4. addTime(Date date, int field, int value)
  5. addTime(Date date, int mode, int amount)
  6. addTime(Date source, int hours, int minutes, int second)
  7. addTimeByDate(int dateNum, Date date)
  8. addTimeIntervals(Date date, int type, int num)