Java Time Format getTimeAfter(int field, int amount, String formatStr)

Here you can find the source of getTimeAfter(int field, int amount, String formatStr)

Description

get Time After

License

Open Source License

Declaration

public static String getTimeAfter(int field, int amount, String formatStr) 

Method Source Code

//package com.java2s;
/**//  w  w w . ja v  a  2s  .  com
 * Project: szs-demo
 * 
 * File Created at 2016?8?19?
 * chiukong
 * 
 * Copyright 2015 Dafy Finance Corporation Limited.
 * All rights reserved.
 *
 * This software is the confidential and proprietary information of
 * Dafy Finance Company. ("Confidential Information").  You shall not
 * disclose such Confidential Information and shall use it only in
 * accordance with the terms of the license agreement you entered into
 * with http://www.dafy.com.
 */

import java.text.SimpleDateFormat;
import java.util.Calendar;

public class Main {

    public static String getTimeAfter(int field, int amount, String formatStr) {
        Calendar cal = Calendar.getInstance();
        cal.add(field, amount);
        SimpleDateFormat sp = new SimpleDateFormat(formatStr);
        return sp.format(cal.getTime());
    }
}

Related

  1. getTime(String dateStr, String format)
  2. getTime(String dateStr, String formate)
  3. getTime(String format)
  4. getTime(String format, String date)
  5. getTime(String timeFormat)
  6. getTimeAsString(final Date date, final String format)
  7. getTimeAsString(String timeFormatAsString)
  8. getTimeByDate(Date date, String timeFormat)
  9. getTimeByFormat(Date date, String format)