Here you can find the source of addMilli(Timestamp nowDate, int period)
Parameter | Description |
---|---|
nowDate | Date |
period | integer |
public static Timestamp addMilli(Timestamp nowDate, int period)
//package com.java2s; /*/*from w w w . ja v a2 s .c o m*/ * Copyright (C) 2010 Viettel Telecom. All rights reserved. * VIETTEL PROPRIETARY/CONFIDENTIAL. Use is subject to license terms. */ import java.sql.Timestamp; import java.util.Calendar; import java.util.Date; public class Main { /** * addMilli.<br> * * @param nowDate Date * @param period integer * @return Timestamp */ //========================================================================== public static Timestamp addMilli(Timestamp nowDate, int period) { Calendar calendar = Calendar.getInstance(); calendar.setTime(nowDate); calendar.add(Calendar.MILLISECOND, period); Timestamp stopTerm = date2Timestamp(calendar.getTime()); return stopTerm; } /** * * @param value Date * @return Timestamp */ public static Timestamp date2Timestamp(Date value) { if (value != null) { return new Timestamp(value.getTime()); } return null; } }