Java Second addSeconds(Date date, int m)

Here you can find the source of addSeconds(Date date, int m)

Description

add Seconds

License

Apache License

Declaration

public static Date addSeconds(Date date, int m) 

Method Source Code


//package com.java2s;
//License from project: Apache License 

import java.text.DateFormat;
import java.text.ParseException;
import java.text.SimpleDateFormat;

import java.util.Date;

public class Main {
    public static Date addSeconds(Date date, int m) {
        return new Date(date.getTime() + m * 1000);
    }//  w w  w  .j ava2s .co m

    public static long getTime(String s) {
        return parseMysql(s).getTime();
    }

    public static Date parseMysql(String s) {
        try {
            DateFormat fmtTemp = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
            return fmtTemp.parse(s);
        } catch (ParseException e) {
            return null;
        }
    }
}

Related

  1. addSecond(Date beginDate, int addcount)
  2. addTimes(String dateTime, int second)
  3. advanceCurrentTimeSeconds()
  4. appendSeconds(StringBuilder time, long seconds)
  5. appendSecondsToEncodeOutput(StringBuilder sb, int sec, int fsec, int precision, boolean fillzeros)