Java SQL Time mergeDateTime(Date date, Time time)

Here you can find the source of mergeDateTime(Date date, Time time)

Description

merge Date Time

License

Apache License

Declaration

public static Calendar mergeDateTime(Date date, Time time) 

Method Source Code


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

import java.sql.Time;

import java.util.Calendar;
import java.util.Date;

public class Main {
    public static Calendar mergeDateTime(Date date, Time time) {
        Calendar cal = Calendar.getInstance();
        if (date != null) {
            cal.setTime(date);/*  w w w  .  ja  v  a2  s  .  c  o  m*/
        }
        if (time != null) {
            Calendar temp = Calendar.getInstance();
            temp.setTime(time);
            cal.set(11, temp.get(11));
            cal.set(12, temp.get(12));
            cal.set(13, temp.get(13));
            cal.set(14, temp.get(14));
        }
        return cal;
    }
}

Related

  1. isTime(final Class type)
  2. isTime(final PropertyDescriptor pd)
  3. isTime(String val)
  4. isTimeInRange(java.sql.Time start, java.sql.Time end, java.util.Date d)
  5. merge(java.util.Date date, java.util.Date time)
  6. minTime()
  7. minutesToTime(int minutes)
  8. parse(String dateTimeString)
  9. parseAMPMFormat(String datetimeString)