Here you can find the source of convertDateToCalendar(final Date d, boolean lenient)
Parameter | Description |
---|---|
d | The date to convert |
lenient | Should parsing be lenient |
public static final Calendar convertDateToCalendar(final Date d, boolean lenient)
//package com.java2s; /**//from w w w. ja v a 2 s. c o m * This is a helper class for the FindPerson() service. * It contains several methods used by the FindPerson service. * * After instantiating this class, the user should call * getMatchCodes() to populate the match codes using the GI * service. Then the matchNameMatchCodeFromCPR(), * matchAddressMatchCodeFromCPR(), and matchCityMatchCodeFromCPR() * methods may be used. * * Copyright 2012 The Pennsylvania State University * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * * @package edu.psu.iam.cpr.core.api.helper * @author $Author$ * @version $Rev$ * @lastrevision $Date$ * */ import java.util.Calendar; import java.util.Date; import java.util.Locale; public class Main { /** * Convert a Date object into a Calendar object. * * @param d The date to convert * @param lenient Should parsing be lenient * * @return a Calendar object */ public static final Calendar convertDateToCalendar(final Date d, boolean lenient) { Calendar cal = Calendar.getInstance(Locale.US); cal.setLenient(lenient); cal.setTime(d); return cal; } }