List of usage examples for java.text DateFormat parse
public Date parse(String source) throws ParseException
From source file:org.openmrs.module.accessmonitor.web.controller.AccessMonitorVisitController.java
@RequestMapping(value = "/module/accessmonitor/visit", method = RequestMethod.GET) public void person(ModelMap model, HttpServletRequest request) { // ((OrderAccessService) Context.getService(OrderAccessService.class)).generateData(); // ((VisitAccessService) Context.getService(VisitAccessService.class)).generateData(); // ((PersonAccessService) Context.getService(PersonAccessService.class)).generateData(); offset = 0;// ww w .j ava 2 s .c o m // parse them to Date, null is acceptabl DateFormat format = new SimpleDateFormat("MM/dd/yyyy"); // Get the from date and to date Date to = null; Date from = null; try { from = format.parse(request.getParameter("datepickerFrom")); } catch (Exception e) { //System.out.println("======From Date Empty======="); } try { to = format.parse(request.getParameter("datepickerTo")); } catch (Exception e) { //System.out.println("======To Date Empty======="); } // get all the records in the date range visitAccessData = ((VisitAccessService) Context.getService(VisitAccessService.class)) .getVisitAccessesByAccessDateOrderByPatientId(from, to); if (visitAccessData == null) { visitAccessData = new ArrayList<VisitServiceAccess>(); } // get date for small graph Date toSmall = to; Date fromSmall = null; Calendar calendar = Calendar.getInstance(); calendar.add(Calendar.DATE, 1); if (toSmall == null) { toSmall = calendar.getTime(); } else { calendar.setTime(toSmall); } calendar.add(Calendar.DATE, -DAYNUM); fromSmall = calendar.getTime(); List<String> dateStrings = new ArrayList<String>(); for (int i = 0; i < DAYNUM; i++) { if (i == DAYNUM - 1) { dateStrings.add(format.format(toSmall)); } else if (i == 0) { dateStrings.add(format.format(fromSmall)); } else { dateStrings.add(""); } } ArrayList<ArrayList<Integer>> tooltip = new ArrayList<ArrayList<Integer>>(); tooltip.add(new ArrayList<Integer>()); for (int j = 0; j < SHOWNUM + 1; j++) { tooltip.get(0).add(1000 + j); } for (int i = 1; i < DAYNUM + 1; i++) { tooltip.add(new ArrayList<Integer>()); tooltip.get(i).add(i); for (int j = 0; j < SHOWNUM; j++) { tooltip.get(i).add(0); } } ArrayList<String> patientIds = new ArrayList<String>(); ArrayList<Integer> patientCounts = new ArrayList<Integer>(); for (VisitServiceAccess va : visitAccessData) { // data for big graph String idString = (va.getPatientId() == null) ? "No ID" : va.getPatientId().toString(); int index = patientIds.indexOf(idString); if (index < 0) { if (patientIds.size() >= SHOWNUM) break; patientIds.add(idString); patientCounts.add(1); index = patientIds.size() - 1;//index = patientIds.indexOf(idString); } else { patientCounts.set(index, patientCounts.get(index) + 1); } // data for small graph if (va.getAccessDate().after(fromSmall) && va.getAccessDate().before(toSmall)) { int index2 = (int) ((va.getAccessDate().getTime() - fromSmall.getTime()) / (1000 * 60 * 60 * 24)); if (index2 < DAYNUM && index2 >= 0) tooltip.get(index2 + 1).set(index + 1, tooltip.get(index2 + 1).get(index + 1) + 1); } } String patientIdString = JSONValue.toJSONString(patientIds); String patientCountString = JSONValue.toJSONString(patientCounts); String dateSmallString = JSONValue.toJSONString(dateStrings); String tooltipdata = JSONValue.toJSONString(tooltip); model.addAttribute("patientIds", patientIdString); model.addAttribute("patientCounts", patientCountString); model.addAttribute("dateSmallString", dateSmallString); model.addAttribute("tooltipdata", tooltipdata); model.addAttribute("user", Context.getAuthenticatedUser()); // model.addAttribute("tables1", visitAccessData); // model.addAttribute("dateSmall", dateStrings); model.addAttribute("currentoffset", String.valueOf(offset)); }
From source file:org.openmrs.module.accessmonitor.web.controller.AccessMonitorOrderController.java
@RequestMapping(value = "/module/accessmonitor/order", method = RequestMethod.POST) public void postSave(ModelMap model, HttpServletRequest request) throws IOException { if (request.getParameter("offset") != null) { offset = Integer.parseInt(request.getParameter("offset")); }/*www.j ava2 s .com*/ int count = -1; // parse them to Date, null is acceptable DateFormat format = new SimpleDateFormat("MM/dd/yyyy"); // Get the from date and to date Date to = null; Date from = null; try { from = format.parse(request.getParameter("datepickerFrom")); } catch (Exception e) { //System.out.println("======From Date Empty======="); } try { to = format.parse(request.getParameter("datepickerTo")); } catch (Exception e) { //System.out.println("======To Date Empty======="); } if (orderAccessData == null || orderAccessData.size() == 0) { // get all the records in the date range orderAccessData = ((OrderAccessService) Context.getService(OrderAccessService.class)) .getOrderAccessesByAccessDateOrderByPatientId(from, to); if (orderAccessData == null) { orderAccessData = new ArrayList<OrderServiceAccess>(); } } // get date for small graph Date toSmall = to; Date fromSmall = null; Calendar calendar = Calendar.getInstance(); calendar.add(Calendar.DATE, 1); if (toSmall == null) { toSmall = calendar.getTime(); } else { calendar.setTime(toSmall); } calendar.add(Calendar.DATE, -DAYNUM); fromSmall = calendar.getTime(); List<String> dateStrings = new ArrayList<String>(); for (int i = 0; i < DAYNUM; i++) { if (i == DAYNUM - 1) { dateStrings.add(format.format(toSmall)); } else if (i == 0) { dateStrings.add(format.format(fromSmall)); } else { dateStrings.add(""); } } ArrayList<ArrayList<Integer>> tooltip = new ArrayList<ArrayList<Integer>>(); tooltip.add(new ArrayList<Integer>()); for (int j = 0; j < SHOWNUM + 1; j++) { tooltip.get(0).add(1000 + j); } for (int i = 1; i < DAYNUM + 1; i++) { tooltip.add(new ArrayList<Integer>()); tooltip.get(i).add(i); for (int j = 0; j < SHOWNUM; j++) { tooltip.get(i).add(0); } } ArrayList<String> patientIds = new ArrayList<String>(); ArrayList<Integer> patientCounts = new ArrayList<Integer>(); String last = ""; for (OrderServiceAccess oa : orderAccessData) { // data for big graph String idString = (oa.getPatientId() == null) ? "No ID" : oa.getPatientId().toString(); if (!idString.equals(last)) { count++; last = idString; } int index = patientIds.indexOf(idString); if (index < 0) { if (count < offset) continue; if (patientIds.size() >= SHOWNUM) break; patientIds.add(idString); patientCounts.add(1); index = patientIds.size() - 1;//index = personIds.indexOf(idString); } else { patientCounts.set(index, patientCounts.get(index) + 1); } // data for small graph if (oa.getAccessDate().after(fromSmall) && oa.getAccessDate().before(toSmall)) { int index2 = (int) ((oa.getAccessDate().getTime() - fromSmall.getTime()) / (1000 * 60 * 60 * 24)); if (index2 < DAYNUM && index2 >= 0) tooltip.get(index2 + 1).set(index + 1, tooltip.get(index2 + 1).get(index + 1) + 1); } } String patientIdString = JSONValue.toJSONString(patientIds); String patientCountString = JSONValue.toJSONString(patientCounts); String dateSmallString = JSONValue.toJSONString(dateStrings); String tooltipdata = JSONValue.toJSONString(tooltip); model.addAttribute("patientIds", patientIdString); model.addAttribute("patientCounts", patientCountString); model.addAttribute("dateSmallString", dateSmallString); model.addAttribute("tooltipdata", tooltipdata); model.addAttribute("user", Context.getAuthenticatedUser()); //model.addAttribute("tables1", orderAccessData); //model.addAttribute("dateSmall", dateStrings); model.addAttribute("currentoffset", String.valueOf(offset)); }
From source file:org.openmrs.module.accessmonitor.web.controller.AccessMonitorPersonController.java
@RequestMapping(value = "/module/accessmonitor/person", method = RequestMethod.POST) public void postSave(ModelMap model, HttpServletRequest request) throws IOException { if (request.getParameter("offset") != null) { offset = Integer.parseInt(request.getParameter("offset")); }/*from w w w . j a v a 2s . c om*/ int count = -1; // parse them to Date, null is acceptabl DateFormat format = new SimpleDateFormat("MM/dd/yyyy"); // Get the from date and to date Date to = null; Date from = null; try { from = format.parse(request.getParameter("datepickerFrom")); } catch (Exception e) { //System.out.println("======From Date Empty======="); } try { to = format.parse(request.getParameter("datepickerTo")); } catch (Exception e) { //System.out.println("======To Date Empty======="); } // get all the records in the date range if (personAccessData == null || personAccessData.size() == 0) { personAccessData = ((PersonAccessService) Context.getService(PersonAccessService.class)) .getPersonAccessesByAccessDateOrderByPersonId(from, to); if (personAccessData == null) { personAccessData = new ArrayList<PersonServiceAccess>(); } } // get date for small graph Date toSmall = to; Date fromSmall = null; Calendar calendar = Calendar.getInstance(); calendar.add(Calendar.DATE, 1); if (toSmall == null) { toSmall = calendar.getTime(); } else { calendar.setTime(toSmall); } calendar.add(Calendar.DATE, -DAYNUM); fromSmall = calendar.getTime(); List<String> dateStrings = new ArrayList<String>(); for (int i = 0; i < DAYNUM; i++) { if (i == DAYNUM - 1) { dateStrings.add(format.format(toSmall)); } else if (i == 0) { dateStrings.add(format.format(fromSmall)); } else { dateStrings.add(""); } } ArrayList<ArrayList<Integer>> tooltip = new ArrayList<ArrayList<Integer>>(); tooltip.add(new ArrayList<Integer>()); for (int j = 0; j < SHOWNUM + 1; j++) { tooltip.get(0).add(1000 + j); } for (int i = 1; i < DAYNUM + 1; i++) { tooltip.add(new ArrayList<Integer>()); tooltip.get(i).add(i); for (int j = 0; j < SHOWNUM; j++) { tooltip.get(i).add(0); } } ArrayList<String> personIds = new ArrayList<String>(); ArrayList<Integer> personCounts = new ArrayList<Integer>(); String last = ""; for (PersonServiceAccess pa : personAccessData) { // data for big graph String idString = (pa.getPersonId() == null) ? "No ID" : pa.getPersonId().toString(); if (!idString.equals(last)) { count++; last = idString; } int index = personIds.indexOf(idString); if (index < 0) { if (count < offset) continue; if (personIds.size() >= SHOWNUM) break; personIds.add(idString); personCounts.add(1); index = personIds.size() - 1;//index = personIds.indexOf(idString); } else { personCounts.set(index, personCounts.get(index) + 1); } // data for small graph if (pa.getAccessDate().after(fromSmall) && pa.getAccessDate().before(toSmall)) { int index2 = (int) ((pa.getAccessDate().getTime() - fromSmall.getTime()) / (1000 * 60 * 60 * 24)); if (index2 < DAYNUM && index2 >= 0) tooltip.get(index2 + 1).set(index + 1, tooltip.get(index2 + 1).get(index + 1) + 1); } } String personIdString = JSONValue.toJSONString(personIds); String personCountString = JSONValue.toJSONString(personCounts); String dateSmallString = JSONValue.toJSONString(dateStrings); String tooltipdata = JSONValue.toJSONString(tooltip); model.addAttribute("personIds", personIdString); model.addAttribute("personCounts", personCountString); model.addAttribute("dateSmallString", dateSmallString); model.addAttribute("tooltipdata", tooltipdata); model.addAttribute("user", Context.getAuthenticatedUser()); //model.addAttribute("tables1", personAccessData); //model.addAttribute("dateSmall", dateStrings); model.addAttribute("currentoffset", String.valueOf(offset)); }
From source file:com.revitasinc.sonar.dp.batch.parser.CvsLogParser.java
/** * Builds a RevisionInfo object from the supplied line. * * @param line//from w w w . j a v a2 s. co m * @param df * @return */ private RevisionInfo infoFromLine(String line, DateFormat df) { RevisionInfo result = null; try { String author = null; Date date = null; int lineCount = 0; String[] secs = line.split(SEMICOLON); for (String sec : secs) { sec = sec.trim(); if (sec.startsWith(DATE)) { date = df.parse(sec.substring(DATE.length())); } else if (sec.startsWith(AUTHOR)) { author = sec.substring(AUTHOR.length()); } else if (sec.startsWith(LINES)) { lineCount = Integer.parseInt(sec.substring(LINES.length() + 1).split(SPACE)[0]); } } result = new RevisionInfo(author, date, EMPTY_STRING, lineCount); } catch (ParseException e) { logger.error(EMPTY_STRING, e); } return result; }
From source file:net.sf.logsaw.dialect.log4j.pattern.Log4JConversionPatternTranslator.java
@Override public void extractField(LogEntry entry, ConversionRule rule, String val) throws CoreException { if (rule.getPlaceholderName().equals("d")) { //$NON-NLS-1$ DateFormat df = rule.getProperty(PROP_DATEFORMAT, DateFormat.class); Assert.isNotNull(df, "dateFormat"); //$NON-NLS-1$ try {// w w w .j a v a2 s . c o m entry.put(Log4JFieldProvider.FIELD_TIMESTAMP, df.parse(val.trim())); } catch (ParseException e) { throw new CoreException(new Status(IStatus.ERROR, Log4JDialectPlugin.PLUGIN_ID, NLS.bind(Messages.Log4JConversionRuleTranslator_error_failedToParseTimestamp, val.trim()))); } } else if (rule.getPlaceholderName().equals("p")) { //$NON-NLS-1$ Level lvl = Log4JFieldProvider.FIELD_LEVEL.getLevelProvider().findLevel(val.trim()); if (ILogLevelProvider.ID_LEVEL_UNKNOWN == lvl.getValue()) { throw new CoreException(new Status(IStatus.WARNING, Log4JDialectPlugin.PLUGIN_ID, NLS.bind(Messages.Log4JConversionRuleTranslator_warning_unknownPriority, val.trim()))); } entry.put(Log4JFieldProvider.FIELD_LEVEL, lvl); } else if (rule.getPlaceholderName().equals("c")) { //$NON-NLS-1$ entry.put(Log4JFieldProvider.FIELD_LOGGER, val.trim()); } else if (rule.getPlaceholderName().equals("t")) { //$NON-NLS-1$ entry.put(Log4JFieldProvider.FIELD_THREAD, val.trim()); } else if (rule.getPlaceholderName().equals("m")) { //$NON-NLS-1$ entry.put(Log4JFieldProvider.FIELD_MESSAGE, val.trim()); } else if (rule.getPlaceholderName().equals("n")) { //$NON-NLS-1$ // nadda } else if (rule.getPlaceholderName().equals("F")) { //$NON-NLS-1$ entry.put(Log4JFieldProvider.FIELD_LOC_FILENAME, val.trim()); } else if (rule.getPlaceholderName().equals("C")) { //$NON-NLS-1$ entry.put(Log4JFieldProvider.FIELD_LOC_CLASS, val.trim()); } else if (rule.getPlaceholderName().equals("M")) { //$NON-NLS-1$ entry.put(Log4JFieldProvider.FIELD_LOC_METHOD, val.trim()); } else if (rule.getPlaceholderName().equals("L")) { //$NON-NLS-1$ entry.put(Log4JFieldProvider.FIELD_LOC_LINE, val.trim()); } else if (rule.getPlaceholderName().equals("x")) { //$NON-NLS-1$ entry.put(Log4JFieldProvider.FIELD_NDC, val.trim()); } else { throw new CoreException(new Status(IStatus.ERROR, Log4JDialectPlugin.PLUGIN_ID, NLS.bind(Messages.Log4JConversionRuleTranslator_error_unsupportedConversionCharacter, rule.getPlaceholderName()))); } }
From source file:org.openmrs.module.accessmonitor.web.controller.AccessMonitorVisitController.java
@RequestMapping(value = "/module/accessmonitor/visit", method = RequestMethod.POST) public void postSave(ModelMap model, HttpServletRequest request) throws IOException { if (request.getParameter("offset") != null) { offset = Integer.parseInt(request.getParameter("offset")); }//from ww w.j a v a 2 s .c o m int count = -1; // parse them to Date, null is acceptabl DateFormat format = new SimpleDateFormat("MM/dd/yyyy"); // Get the from date and to date Date to = null; Date from = null; try { from = format.parse(request.getParameter("datepickerFrom")); } catch (Exception e) { //System.out.println("======From Date Empty======="); } try { to = format.parse(request.getParameter("datepickerTo")); } catch (Exception e) { //System.out.println("======To Date Empty======="); } if (visitAccessData == null || visitAccessData.size() == 0) { // get all the records in the date range visitAccessData = ((VisitAccessService) Context.getService(VisitAccessService.class)) .getVisitAccessesByAccessDateOrderByPatientId(from, to); if (visitAccessData == null) { visitAccessData = new ArrayList<VisitServiceAccess>(); } } // get date for small graph Date toSmall = to; Date fromSmall = null; Calendar calendar = Calendar.getInstance(); calendar.add(Calendar.DATE, 1); if (toSmall == null) { toSmall = calendar.getTime(); } else { calendar.setTime(toSmall); } calendar.add(Calendar.DATE, -DAYNUM); fromSmall = calendar.getTime(); List<String> dateStrings = new ArrayList<String>(); for (int i = 0; i < DAYNUM; i++) { if (i == DAYNUM - 1) { dateStrings.add(format.format(toSmall)); } else if (i == 0) { dateStrings.add(format.format(fromSmall)); } else { dateStrings.add(""); } } ArrayList<ArrayList<Integer>> tooltip = new ArrayList<ArrayList<Integer>>(); tooltip.add(new ArrayList<Integer>()); for (int j = 0; j < SHOWNUM + 1; j++) { tooltip.get(0).add(1000 + j); } for (int i = 1; i < DAYNUM + 1; i++) { tooltip.add(new ArrayList<Integer>()); tooltip.get(i).add(i); for (int j = 0; j < SHOWNUM; j++) { tooltip.get(i).add(0); } } ArrayList<String> patientIds = new ArrayList<String>(); ArrayList<Integer> patientCounts = new ArrayList<Integer>(); String last = ""; for (VisitServiceAccess va : visitAccessData) { // data for big graph String idString = (va.getPatientId() == null) ? "No ID" : va.getPatientId().toString(); if (!idString.equals(last)) { count++; last = idString; } int index = patientIds.indexOf(idString); if (index < 0) { if (count < offset) continue; if (patientIds.size() >= SHOWNUM) break; patientIds.add(idString); patientCounts.add(1); index = patientIds.size() - 1;//index = patientIds.indexOf(idString); } else { patientCounts.set(index, patientCounts.get(index) + 1); } // data for small graph if (va.getAccessDate().after(fromSmall) && va.getAccessDate().before(toSmall)) { int index2 = (int) ((va.getAccessDate().getTime() - fromSmall.getTime()) / (1000 * 60 * 60 * 24)); if (index2 < DAYNUM && index2 >= 0) tooltip.get(index2 + 1).set(index + 1, tooltip.get(index2 + 1).get(index + 1) + 1); } } String patientIdString = JSONValue.toJSONString(patientIds); String patientCountString = JSONValue.toJSONString(patientCounts); String dateSmallString = JSONValue.toJSONString(dateStrings); String tooltipdata = JSONValue.toJSONString(tooltip); model.addAttribute("patientIds", patientIdString); model.addAttribute("patientCounts", patientCountString); model.addAttribute("dateSmallString", dateSmallString); model.addAttribute("tooltipdata", tooltipdata); model.addAttribute("user", Context.getAuthenticatedUser()); // model.addAttribute("tables1", visitAccessData); // model.addAttribute("dateSmall", dateStrings); model.addAttribute("currentoffset", String.valueOf(offset)); }
From source file:jef.tools.DateUtils.java
/** * ? ?//from w w w . ja v a2s .com * * @Title: parse */ public static Date parse(String s, DateFormat format) throws ParseException { if (StringUtils.isBlank(s)) return null; return format.parse(s); }
From source file:org.androidpn.server.console.controller.OnlineStatusController.java
public ModelAndView getCountChart(HttpServletRequest request, HttpServletResponse response) throws Exception { String startTimeStr = request.getParameter("start"); String endTimeStr = request.getParameter("end"); DateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); Date endTime = endTimeStr == null ? new Date() : format.parse(endTimeStr); Date startTime = startTimeStr == null ? new Date() : format.parse(startTimeStr); List<OnlineUserCount> list = onlineUserCountService.getAllRecords(startTime, endTime, "time", Order.asc); ModelAndView mav = new ModelAndView(); mav.addObject("list", list); mav.setViewName("online/chart_count"); return mav;/* w w w . ja v a2s . co m*/ }
From source file:com.appeligo.search.actions.account.BaseAccountAction.java
public void setLatestSmsTime(String latestSmsTime) { DateFormat format = SimpleDateFormat.getTimeInstance(DateFormat.SHORT); try {/*from ww w . j a va 2 s. c o m*/ this.latestSmsTime = new Time(format.parse(latestSmsTime).getTime()); } catch (ParseException e) { log.error("Format from account_macros.vm was wrong", e); } }
From source file:biz.taoconsulting.dominodav.methods.PROPPATCH.java
/** * (non-Javadoc)//from w ww.j a v a 2 s . c o m * * @see biz.taoconsulting.dominodav.methods.AbstractDAVMethod#action() */ @SuppressWarnings("deprecation") protected void action() throws Exception { // TODO Implement! IDAVRepository rep = this.getRepository(); String curURI = (String) this.getHeaderValues().get("uri"); IDAVResource resource = null; String relockToken = this.getRelockToken(this.getReq()); LockManager lm = this.getLockManager(); // int status = HttpServletResponse.SC_OK; // We presume success LockInfo li = null; HttpServletResponse resp = this.getResp(); Long TimeOutValue = this.getTimeOutValue(this.getReq()); try { // LOGGER.info("getResource"); resource = rep.getResource(curURI, true); } catch (DAVNotFoundException e) { // This exception isn't a problem since we just can create the new // URL // LOGGER.info("Exception not found resource"); } if (resource == null) { // LOGGER.info("Error, resource is null"); // Set the return error // Unprocessable Entity (see // http://www.webdav.org/specs/rfc2518.html#status.code.extensions.to.http11) this.setHTTPStatus(403); return; } if (resource.isReadOnly()) { this.setHTTPStatus(403); return; } if (relockToken != null) { li = lm.relock(resource, relockToken, TimeOutValue); if (li == null) { String eString = "Relock failed for " + relockToken; LOGGER.debug(eString); this.setErrorMessage(eString, 423); // Precondition failed this.setHTTPStatus(423); return; } } String creationDate = null, modifiedDate = null; Date dt = new Date(); Date dtM = new Date(); DocumentBuilderFactory dbFactory = DocumentBuilderFactory.newInstance(); LOGGER.info("DB Factory built OK"); DocumentBuilder dBuilder = dbFactory.newDocumentBuilder(); LOGGER.info("Document builder OK"); Document doc = dBuilder.parse(this.getReq().getInputStream()); LOGGER.info("XML Doc ok read"); if (doc != null) { LOGGER.info("doc is not null"); NodeList nlCreation = doc.getElementsByTagName("Z:Win32CreationTime"); NodeList nlModified = doc.getElementsByTagName("Z:Win32LastModifiedTime"); if (nlCreation != null) { LOGGER.info("nlCreation not null"); Node nNodeCreation = nlCreation.item(0); if (nNodeCreation != null) { LOGGER.info("nNodeCreation not null, is " + nNodeCreation.getTextContent()); creationDate = nNodeCreation.getTextContent(); LOGGER.info("Creation date=" + creationDate + " Locale is " + this.getReq().getLocale().toString()); DateFormat df = new SimpleDateFormat("EEE, dd MMM yyyy HH:mm:ss z", Locale.getDefault()); LOGGER.info("SimpleDate Format ok created"); try { dt = df.parse(creationDate); } catch (Exception e) { creationDate += "+00"; dt = df.parse(creationDate); } try { // dt.setTime(dt.getTime()-3*60*60*1000); resource.patchCreationDate(dt); } catch (Exception e) { } LOGGER.info("Date dt parsed with value=" + dt.toString()); } } if (nlModified != null) { LOGGER.info("nlModified not null"); Node nNodeModified = nlModified.item(0); if (nNodeModified != null) { LOGGER.info("nNodeModified not null"); modifiedDate = nNodeModified.getTextContent(); LOGGER.info("Modified date=" + modifiedDate); Locale defLoc = Locale.getDefault(); // This is the crap reason why Win7 didn;t work! DateFormat df = new SimpleDateFormat("EEE, dd MMM yyyy HH:mm:ss z", defLoc); try { dtM = df.parse(modifiedDate); } catch (Exception e) { modifiedDate += "+00"; dtM = df.parse(modifiedDate); } try { // dtM.setTime(dtM.getTime()-3*60*60*1000); resource.patchLastModified(dtM); } catch (Exception e) { } LOGGER.info("Date dtM parsed with value=" + dtM.toString()); } } } IDAVXMLResponse xr = DavXMLResponsefactory.getXMLResponse(null, false); xr.openTag("multistatus"); resource.addToDavXMLResponsePROPPATCH(xr); xr.closeDocument(); this.setHTTPStatus(DAVProperties.STATUS_MULTIPART); // FIXME: this is depricated! resp.setStatus(DAVProperties.STATUS_MULTIPART, DAVProperties.STATUS_MULTIPART_STRING); resp.setContentType(DAVProperties.TYPE_XML); String result = xr.toString(); resp.setContentLength(result.length()); PrintWriter out = resp.getWriter(); out.write(result); out.close(); }