List of usage examples for java.text SimpleDateFormat setLenient
public void setLenient(boolean lenient)
From source file:org.bathbranchringing.emailer.core.converters.DateFormatter.java
private SimpleDateFormat createDateFormat(final Locale locale) { final String format = this.messageSource.getMessage("datetime.input.format", null, locale); final SimpleDateFormat dateFormat = new SimpleDateFormat(format); dateFormat.setLenient(false); return dateFormat; }
From source file:ch.ralscha.extdirectspring_itest.UserServiceInitBinderService.java
@InitBinder public void initBinder(WebDataBinder binder) { SimpleDateFormat dateFormat = new SimpleDateFormat("dd.MM.yyyy"); dateFormat.setLenient(false); binder.registerCustomEditor(Date.class, new CustomDateEditor(dateFormat, true)); }
From source file:com.example.web.ui.conversion.DateFormatter.java
private SimpleDateFormat createDateFormat(final Locale locale) { // final String format = this.messageSource.getMessage("date.format", null, locale); final SimpleDateFormat dateFormat = new SimpleDateFormat("dd/MM/YYYY"); dateFormat.setLenient(false); return dateFormat; }
From source file:org.thymeleaf.engine.springintegration.context.SpringIntegrationWebProcessingContextBuilder.java
@Override protected void initBinder(final String bindingVariableName, final Object bindingObject, final ITest test, final DataBinder dataBinder, final Locale locale, final Map<String, Object> variables) { final ITestMessages messages = test.getMessages(); if (messages == null) { throw new TestEngineExecutionException("Test \"" + test.getName() + "\" returns no messages object."); }// w w w . j a v a 2s .co m final String dateformat = messages.computeMessage(locale, "date.format", null); final SimpleDateFormat sdf = new SimpleDateFormat(dateformat); sdf.setLenient(false); dataBinder.registerCustomEditor(Date.class, new CustomDateEditor(sdf, false)); }
From source file:egovframework.rte.tex.com.web.EgovBindingInitializer.java
/** * initBinder//from w w w. ja va2 s . c o m * @param binder * @param request * @see ?? */ public void initBinder(WebDataBinder binder, WebRequest request) { SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd", Locale.KOREA); dateFormat.setLenient(false); binder.registerCustomEditor(Date.class, new CustomDateEditor(dateFormat, false)); binder.registerCustomEditor(String.class, new StringTrimmerEditor(false)); }
From source file:com.jklas.sample.petclinic.web.AbstractClinicForm.java
/** * Set up a custom property editor for the application's date format. */// w w w . ja v a2 s .c o m protected void initBinder(HttpServletRequest request, ServletRequestDataBinder binder) { SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd"); dateFormat.setLenient(false); binder.registerCustomEditor(Date.class, new CustomDateEditor(dateFormat, false)); }
From source file:org.imsglobal.simplelti.SimpleLTIUtil.java
public static Date parseISO8601(String str) { SimpleDateFormat formatter = new SimpleDateFormat(outBoundISO8601); try {/*from w w w .java2s .co m*/ formatter.setTimeZone(TimeZone.getTimeZone("GMT")); Date dt = formatter.parse(str); // System.out.println("Outbound="+dt); return dt; } catch (Exception e) { // Keep on trying } formatter = new SimpleDateFormat(inBoundISO8601B); try { // This should have timezone for us to read formatter.setLenient(true); Date dt = formatter.parse(str); // System.out.println("Inbound B="+dt); return dt; } catch (Exception e) { // Keep on trying } formatter = new SimpleDateFormat(inBoundISO8601C); try { formatter.setTimeZone(TimeZone.getTimeZone("GMT")); formatter.setLenient(true); Date dt = formatter.parse(str); // System.out.println("Inbound C="+dt); return dt; } catch (Exception e) { // Keep on trying } return null; }
From source file:egovframework.example.cmmn.web.EgovBindingInitializer.java
/** * initBinder//from w ww . j a va2s. c om * @param binder * @param request * @see ?? */ @Override public void initBinder(WebDataBinder binder, WebRequest request) { SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd", Locale.getDefault()); dateFormat.setLenient(false); binder.registerCustomEditor(Date.class, new CustomDateEditor(dateFormat, false)); binder.registerCustomEditor(String.class, new StringTrimmerEditor(false)); }
From source file:org.hydroponics.web.controller.AddFertilizer.java
@InitBinder public void setAllowedFields(WebDataBinder dataBinder) { logger.info("WebDataBinder:"); SimpleDateFormat dateFormat = new SimpleDateFormat("MM/dd/yyyy"); dateFormat.setLenient(false); dataBinder.registerCustomEditor(Date.class, new CustomDateEditor(dateFormat, true)); }
From source file:cz.swi2.mendeluis.app.web.controllers.RegistrationController.java
/** * Initializes input fields validators. */// ww w. ja v a2 s. c o m @InitBinder public void initBinder(WebDataBinder binder) { SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); sdf.setLenient(false); binder.registerCustomEditor(Date.class, "dateOfBirth", new CustomDateEditor(sdf, true)); }