Android Calendar Add getDateByAddFltHour(float flt)

Here you can find the source of getDateByAddFltHour(float flt)

Description

get Date By Add Flt Hour

Declaration

public static String getDateByAddFltHour(float flt) 

Method Source Code

//package com.java2s;

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

public class Main {
    public static String getDateByAddFltHour(float flt) {
        int addMinute = (int) (flt * 60);
        Calendar cal = new GregorianCalendar();
        cal.setTime(new Date());
        cal.add(GregorianCalendar.MINUTE, addMinute);
        return getFormatDateTime(cal.getTime(), "yyyy-MM-dd HH:mm:ss");
    }//w  w w . ja  v  a  2  s. co  m

    public static String getFormatDateTime(Date date, String format) {
        SimpleDateFormat sdf = new SimpleDateFormat(format);
        return sdf.format(date);
    }
}

Related

  1. addDay(Calendar c, int days)
  2. addMonth(Calendar c, int months)
  3. after(Calendar c, long offset)
  4. afterNDays(Calendar c, int n)
  5. getDateAdd(Date date, int amount)
  6. getDateByAddHour(String datetime, int minute)
  7. getFormatCurrentAdd(int amount, String format)
  8. tomorrow(Calendar c)
  9. yesterday(Calendar c)