Java Calendar Time mergeDateTime(Calendar date, Calendar time)

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

Description

merge Date Time

License

Open Source License

Declaration

public static Calendar mergeDateTime(Calendar date, Calendar time) 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

import java.util.Calendar;

public class Main {
    public static Calendar mergeDateTime(Calendar date, Calendar time) {
        Calendar clendar = null;// www  .  ja  va2  s.  c  o m
        if (date != null && time != null) {
            clendar = Calendar.getInstance();
            clendar.set(Calendar.YEAR, date.get(Calendar.YEAR));
            clendar.set(Calendar.MONTH, date.get(Calendar.MONTH));
            clendar.set(Calendar.DAY_OF_MONTH,
                    date.get(Calendar.DAY_OF_MONTH));
            //
            clendar.set(Calendar.HOUR_OF_DAY,
                    time.get(Calendar.HOUR_OF_DAY));
            clendar.set(Calendar.MINUTE, time.get(Calendar.MINUTE));
            clendar.set(Calendar.SECOND, time.get(Calendar.SECOND));
            clendar.set(Calendar.MILLISECOND,
                    time.get(Calendar.MILLISECOND));
        }
        return clendar;
    }
}

Related

  1. isTime0(final Calendar calendar)
  2. isWorkTime(Calendar calendar, String workTimeStart, String workTimeEnd)
  3. maximizeTimeFields(final Calendar calendar)
  4. merge(Calendar date, Calendar time)
  5. mergeDateAndTime(final Calendar date, final Calendar time)
  6. newCalendar(final long time)
  7. newCalendarInstance(TimeZone timeZone)
  8. normalizeLocalTime(final Calendar cal)
  9. parseTime(Calendar calendar, String time_string)