Add DateUtils.toCalendar(Date, TimeZone)
This commit is contained in:
parent
db6f7c1d74
commit
1eecfc948b
|
@ -666,6 +666,19 @@ public class DateUtils {
|
||||||
return c;
|
return c;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//-----------------------------------------------------------------------
|
||||||
|
/**
|
||||||
|
* Converts a {@code Date} of a given {@code TimeZone} into a {@code Calendar}
|
||||||
|
* @param date the date to convert to a Calendar
|
||||||
|
* @param timeZone the time zone of the @{code date}
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public static Calendar toCalendar(final Date date, final TimeZone tz) {
|
||||||
|
final Calendar c = Calendar.getInstance(tz);
|
||||||
|
c.setTime(date);
|
||||||
|
return c;
|
||||||
|
}
|
||||||
|
|
||||||
//-----------------------------------------------------------------------
|
//-----------------------------------------------------------------------
|
||||||
/**
|
/**
|
||||||
* <p>Rounds a date, leaving the field specified as the most
|
* <p>Rounds a date, leaving the field specified as the most
|
||||||
|
|
Loading…
Reference in New Issue