List of usage examples for java.text SimpleDateFormat setTimeZone
public void setTimeZone(TimeZone zone)
From source file:it.jugpadova.controllers.EventController.java
private EventSearch buildEventSearch(HttpServletRequest req) throws ParseException { SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd"); df.setLenient(false);/*from w w w . j a v a 2 s . c om*/ df.setTimeZone(TimeZone.getTimeZone("GMT")); EventSearch eventSearch = new EventSearch(); eventSearch.setContinent(req.getParameter("continent")); eventSearch.setCountry(req.getParameter("country")); eventSearch.setJugName(req.getParameter("jugName")); eventSearch.setPastEvents(java.lang.Boolean.parseBoolean(req.getParameter("pastEvents"))); eventSearch.setOrderByDate(req.getParameter("order")); String maxResults = req.getParameter("maxResults"); if (StringUtils.isNotBlank(maxResults)) { try { eventSearch.setMaxResults(new Integer(maxResults)); } catch (NumberFormatException numberFormatException) { /* ignore it */ } } eventSearch.setFriendlyName(req.getParameter("friendlyName")); String startDate = req.getParameter("startDate"); if (StringUtils.isNotBlank(startDate)) { Date date = df.parse(startDate); eventSearch.setStartDate(date); } String endDate = req.getParameter("endDate"); if (StringUtils.isNotBlank(endDate)) { Date date = df.parse(endDate); eventSearch.setEndDate(date); } String startTimestamp = req.getParameter("start"); if (StringUtils.isNotBlank(startTimestamp)) { Date date = new Date(Long.parseLong(startTimestamp) * 1000); eventSearch.setStartDate(date); } String endTimestamp = req.getParameter("end"); if (StringUtils.isNotBlank(endTimestamp)) { Date date = new Date(Long.parseLong(endTimestamp) * 1000); eventSearch.setEndDate(date); } return eventSearch; }
From source file:io.restassured.http.Cookie.java
@Override public String toString() { final StringBuilder builder = new StringBuilder(); builder.append(name);//from www .ja v a 2 s .c om if (hasValue()) { builder.append(EQUALS).append(value); } if (hasComment()) { builder.append(COOKIE_ATTRIBUTE_SEPARATOR).append(COMMENT).append(EQUALS).append(comment); } if (hasPath()) { builder.append(COOKIE_ATTRIBUTE_SEPARATOR).append(PATH).append(EQUALS).append(path); } if (hasDomain()) { builder.append(COOKIE_ATTRIBUTE_SEPARATOR).append(DOMAIN).append(EQUALS).append(domain); } if (hasMaxAge()) { builder.append(COOKIE_ATTRIBUTE_SEPARATOR).append(MAX_AGE).append(EQUALS).append(maxAge); } if (isSecured()) { builder.append(COOKIE_ATTRIBUTE_SEPARATOR).append(SECURE); } if (isHttpOnly()) { builder.append(COOKIE_ATTRIBUTE_SEPARATOR).append(HTTP_ONLY); } if (hasExpiryDate()) { final SimpleDateFormat simpleDateFormat = new SimpleDateFormat(); simpleDateFormat.setTimeZone(TimeZone.getTimeZone("GMT")); builder.append(COOKIE_ATTRIBUTE_SEPARATOR).append(EXPIRES).append(EQUALS) .append(simpleDateFormat.format(expiryDate)); } if (hasVersion()) { builder.append(COOKIE_ATTRIBUTE_SEPARATOR).append(VERSION).append(EQUALS).append(version); } return builder.toString(); }
From source file:net.oddsoftware.android.html.HttpCache.java
private HttpUriRequest createHttpRequest(String url, String eTag, long lastModified) { HttpGet request = null;//from www . j a v a 2 s. c o m try { request = new HttpGet(url); } catch (IllegalArgumentException exc) { if (Globals.LOGGING) Log.e(Globals.LOG_TAG, "createHttpRequest: error creating http get", exc); return null; } request.setHeader("User-Agent", FeedManager.USER_AGENT); request.setHeader("Accept-Encoding", "gzip,deflate"); // send etag if we have it if (eTag != null && eTag.length() > 0) { request.setHeader("If-None-Match", eTag); } // send If-Modified-Since if we have it if (lastModified > 0) { SimpleDateFormat dateFormat = new SimpleDateFormat("EEE', 'dd' 'MMM' 'yyyy' 'HH:mm:ss' GMT'", Locale.US); dateFormat.setTimeZone(TimeZone.getTimeZone("GMT")); String formattedTime = dateFormat.format(lastModified); // If-Modified-Since: Sat, 29 Oct 1994 19:43:31 GMT request.setHeader("If-Modified-Since", formattedTime); } return request; }
From source file:com.clustercontrol.viewer.CommonTableLabelProvider.java
/** * ??/*from ww w. ja va 2 s.co m*/ * * @since 1.0.0 * @see org.eclipse.jface.viewers.ITableLabelProvider#getColumnText(java.lang.Object, * int) */ @Override public String getColumnText(Object element, int columnIndex) { ArrayList<TableColumnInfo> tableColumnList = m_viewer.getTableColumnList(); ArrayList<?> list = (ArrayList<?>) element; if (list.size() <= columnIndex) { m_log.debug("Bad implements. IndexOutOfBoundsException." + " list.size=" + list.size() + ", columnIndex=" + columnIndex); return ""; } Object item = list.get(columnIndex); TableColumnInfo tableColumn = tableColumnList.get(columnIndex); if (item == null || item.equals("")) { return ""; } if (tableColumn.getType() == TableColumnInfo.JOB) { //???? return JobMessage.typeToString(((Number) item).intValue()); } else if (tableColumn.getType() == TableColumnInfo.STATE) { //???? return StatusMessage.typeToString(((Number) item).intValue()); } else if (tableColumn.getType() == TableColumnInfo.PRIORITY) { //?????? return PriorityMessage.typeToString(((Number) item).intValue()); } else if (tableColumn.getType() == TableColumnInfo.VALID) { //?/??? return ValidMessage.typeToString(((Boolean) item).booleanValue()); } else if (tableColumn.getType() == TableColumnInfo.JUDGMENT_OBJECT) { //???? return JudgmentObjectMessage.typeToString(((Number) item).intValue()); } else if (tableColumn.getType() == TableColumnInfo.NOTIFY_TYPE) { //???? return NotifyTypeUtil.typeToString(((Number) item).intValue()); } else if (tableColumn.getType() == TableColumnInfo.WAIT_RULE_VALUE) { //????? Class<?> itemClass = item.getClass(); if (itemClass == Date.class) { //?0??24(??48)?? return TimeStringConverter.formatTime((Date) item); } else if (itemClass == String.class) { return String.valueOf(item); } else if (itemClass.getSuperclass() == Number.class) { return ((Number) item).toString(); } } else if (tableColumn.getType() == TableColumnInfo.SCHEDULE) { //???? Schedule schedule = (Schedule) item; String scheduleString = null; DecimalFormat format = new DecimalFormat("00"); if (schedule.getType() == ScheduleConstant.TYPE_DAY) { if (schedule.getMonth() != null) { scheduleString = format.format(schedule.getMonth()) + "/" + format.format(schedule.getDay()) + " " + format.format(schedule.getHour()) + ":" + format.format(schedule.getMinute()); } else if (schedule.getDay() != null) { scheduleString = format.format(schedule.getDay()) + Messages.getString("monthday") + " " + format.format(schedule.getHour()) + ":" + format.format(schedule.getMinute()); } else if (schedule.getHour() != null) { scheduleString = format.format(schedule.getHour()) + ":" + format.format(schedule.getMinute()); } else if (schedule.getMinute() != null) { scheduleString = format.format(schedule.getMinute()) + Messages.getString("minute"); } } else if (schedule.getType() == ScheduleConstant.TYPE_WEEK) { if (schedule.getHour() != null) { scheduleString = DayOfWeekConstant.typeToString(schedule.getWeek()) + " " + format.format(schedule.getHour()) + ":" + format.format(schedule.getMinute()); } else { scheduleString = DayOfWeekConstant.typeToString(schedule.getWeek()) + " " + format.format(schedule.getMinute()) + Messages.getString("minute"); } } else { // ??????? m_log.warn("CommonTableLabelProvider 165"); } return scheduleString; } else if (tableColumn.getType() == TableColumnInfo.CONFIRM) { //??/???? return ConfirmMessage.typeToString(((Number) item).intValue()); } else if (tableColumn.getType() == TableColumnInfo.WAIT_RULE) { //?????? return YesNoMessage.typeToString(((Boolean) item).booleanValue()); } else if (tableColumn.getType() == TableColumnInfo.PROCESS) { //????? return ProcessMessage.typeToString(((Boolean) item).booleanValue()); } else if (tableColumn.getType() == TableColumnInfo.END_STATUS) { //???? return EndStatusMessage.typeToString(((Number) item).intValue()); } else if (tableColumn.getType() == TableColumnInfo.CHECKBOX) { //????? return ""; } else if (tableColumn.getType() == TableColumnInfo.DAY_OF_WEEK) { //???? return DayOfWeekConstant.typeToString(((Number) item).intValue()); } else if (tableColumn.getType() == TableColumnInfo.SCHEDULE_ON_OFF) { //???? return ""; } else if (tableColumn.getType() == TableColumnInfo.JOB_PARAM_TYPE) { //???? return JobParamTypeMessage.typeToString(((Number) item).intValue()); } else if (tableColumn.getType() == TableColumnInfo.COLLECT_STATUS) { //????? return PerformanceStatusConstant.typeToString(((Boolean) item).booleanValue()); } else if (tableColumn.getType() == TableColumnInfo.JOB_RUNTIME_PARAM_TYPE) { //???? return String.format("%s(%s)", JobParamTypeMessage.STRING_RUNTIME, JobRuntimeParamTypeMessage.typeToString(((Number) item).intValue())); } else if (tableColumn.getType() == TableColumnInfo.JOB_RUNTIME_PARAM_TYPE) { //???? return String.format("%s(%s)", JobParamTypeMessage.STRING_RUNTIME, JobRuntimeParamTypeMessage.typeToString(((Number) item).intValue())); } else if (tableColumn.getType() == TableColumnInfo.JOBMAP_ICON_IMAGE) { //???? return ""; } else if (tableColumn.getType() == TableColumnInfo.APPROVAL_STATUS) { //????? return JobApprovalStatusMessage.typeToString(((Number) item).intValue()); } else if (tableColumn.getType() == TableColumnInfo.APPROVAL_RESULT) { //?????? return JobApprovalResultMessage.typeToString(((Number) item).intValue()); } else if (tableColumn.getType() == TableColumnInfo.DECISION_CONDITION) { //????? return DecisionObjectMessage.typeToString(((Number) item).intValue()); } else { //??? Class<?> itemClass = item.getClass(); if (itemClass == String.class) { return String.valueOf(item); } else if (itemClass == Date.class) { return TimezoneUtil.getSimpleDateFormat().format((Date) item); } else if (itemClass == Time.class) { SimpleDateFormat formatter = new SimpleDateFormat("HH:mm:ss"); formatter.setTimeZone(TimezoneUtil.getTimeZone()); return formatter.format((Time) item); } else if (itemClass.getSuperclass() == Number.class) { return ((Number) item).toString(); } else if (itemClass.isEnum()) { return ((Enum<?>) item).toString(); } else { return item.toString(); } } return ""; }
From source file:org.aludratest.hpalm.infrastructure.HpAlmSession.java
public TimeZone determineServerTimeZone() throws IOException, HpAlmException { // get time values from server ServerTime serverTime = getServerTime(); long millis = Long.parseLong(serverTime.getTimeInMillis()); SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); sdf.setTimeZone(TimeZone.getTimeZone("GMT")); long compare; try {// w w w . ja va 2 s.c o m compare = sdf.parse(serverTime.getDateTime()).getTime(); } catch (ParseException pe) { throw new HpAlmException("HP ALM returned unparseable datetime string: " + serverTime.getDateTime()); } long diff = compare - millis; int diffHours = (int) Math.round(diff / (1000l * 60 * 60.0)); int diffMinutes = (int) Math.abs(Math.round((diff - (diffHours * 1000l * 60 * 60)) / (1000l * 60.0))); String determinedTimeZone = "" + diffMinutes; if (determinedTimeZone.length() == 1) { determinedTimeZone = "0" + determinedTimeZone; } determinedTimeZone = "GMT" + (diffHours < 0 ? "" : "+") + diffHours + ":" + determinedTimeZone; return TimeZone.getTimeZone(determinedTimeZone); }
From source file:de.hybris.platform.marketplaceintegrationbackoffice.renderer.MarketplaceIntegrationOrderRequestRenderer.java
private void orderRequestDownload(final MarketplaceStoreModel model) { if (null == model.getRequestStartTime()) { NotificationUtils//from w w w. ja v a2s .co m .notifyUserVia( Localization.getLocalizedString( "type.Marketplacestore." + MarketplaceStoreModel.REQUESTSTARTTIME + ".name") + " " + Labels.getLabel("backoffice.field.notfilled"), NotificationEvent.Type.WARNING, ""); LOG.warn("Order request start time is not filled!"); return; } else if (null == model.getRequestEndTime()) { NotificationUtils.notifyUserVia(Localization .getLocalizedString("type.Marketplacestore." + MarketplaceStoreModel.REQUESTENDTIME + ".name") + " " + Labels.getLabel("backoffice.field.notfilled"), NotificationEvent.Type.WARNING, ""); LOG.warn("Order request end time is not filled!"); return; } else if (model.getRequestStartTime().after(model.getRequestEndTime())) { NotificationUtils.notifyUserVia(Labels.getLabel("backoffice.field.timerange.error"), NotificationEvent.Type.WARNING, ""); LOG.warn("start time is greater than end time!"); return; } if (!StringUtils.isBlank(model.getIntegrationId()) && !model.getAuthorized().booleanValue()) { NotificationUtils.notifyUserVia(Labels.getLabel("marketplace.order.authorization.fail"), NotificationEvent.Type.WARNING, ""); LOG.warn("authorization is expired!"); return; } //in order to avoid this value out of date, we only get it from database final Boolean isAuth = ((MarketplaceStoreModel) modelService.get(model.getPk())).getAuthorized(); final String integrationId = ((MarketplaceStoreModel) modelService.get(model.getPk())).getIntegrationId(); model.setIntegrationId(integrationId); model.setAuthorized(isAuth); if (null == isAuth || !isAuth.booleanValue()) { NotificationUtils.notifyUserVia(Labels.getLabel("marketplace.refund.requestorder.unauthed"), NotificationEvent.Type.WARNING, ""); LOG.warn("marketplace store do not authorized, download refund/return order failed!"); return; } String urlStr = ""; final String logUUID = logUtil.getUUID(); final MarketplaceSellerModel seller = model.getMarketplaceSeller(); final MarketplaceModel marketPlace = seller.getMarketplace(); try { // Configure and open a connection to the site you will send the urlStr = marketPlace.getAdapterUrl() + Config.getParameter(MARKETPLACE_REFUND_SYCHRONIZE_PATH) + Config.getParameter(MARKETPLACE_REFUND_REQUEST_PATH) + integrationId + Config.getParameter(MARKETPLACE_REFUND_REQUEST_LOGUUID) + logUUID; final JSONObject jsonObj = new JSONObject(); jsonObj.put("batchSize", BATCH_SIZE); //set the correct timezone final String configTimezone = model.getMarketplace().getTimezone(); boolean isValidTimezone = false; for (final String vaildTimezone : TimeZone.getAvailableIDs()) { if (vaildTimezone.equals(configTimezone)) { isValidTimezone = true; break; } } if (!isValidTimezone) { final String[] para = { configTimezone == null ? "" : configTimezone, model.getMarketplace().getName() }; NotificationUtils.notifyUserVia(Labels.getLabel("marketplace.order.initorder.wrongtimezone", para), NotificationEvent.Type.WARNING, ""); LOG.warn("wrong timezone or missing timezone configed in market:" + model.getMarketplace().getName()); return; } final SimpleDateFormat format = new SimpleDateFormat(Config.getParameter(BACKOFFICE_FORMAT_DATEFORMAT)); format.setTimeZone(TimeZone.getTimeZone(configTimezone)); final String startTimeWithCorrectZone = format.format(model.getRequestStartTime()).toString(); final String endTimeWithCorrectZone = format.format(model.getRequestEndTime()).toString(); logUtil.addMarketplaceLog("PENDING", integrationId, Labels.getLabel("marketplace.order.requestorder.action"), model.getItemtype(), marketPlace, model, logUUID); jsonObj.put("startCreated", startTimeWithCorrectZone); jsonObj.put("endCreated", endTimeWithCorrectZone); jsonObj.put("productCatalogVersion", model.getCatalogVersion().getCatalog().getId() + ":" + model.getCatalogVersion().getVersion()); jsonObj.put("currency", model.getCurrency().getIsocode()); marketplaceHttpUtil.post(urlStr, jsonObj.toJSONString()); } catch (final HttpClientErrorException httpError) { if (httpError.getStatusCode().is4xxClientError()) { LOG.error("========================================================================="); LOG.error("Order Request post to Tmall failed!"); LOG.error("Marketplacestore Code: " + model.getName()); LOG.error("Error Status Code: " + httpError.getStatusCode().toString()); LOG.error("Request path: " + urlStr); LOG.error("-------------------------------------------------------------------------"); LOG.error("Failed Reason:"); LOG.error("Requested Tmall service URL is not correct!"); LOG.error("-------------------------------------------------------------------------"); LOG.error("Detail error info: " + httpError.getMessage()); LOG.error("========================================================================="); NotificationUtils.notifyUserVia(Labels.getLabel("marketplace.error.request.post.error"), NotificationEvent.Type.FAILURE, ""); } if (httpError.getStatusCode().is5xxServerError()) { LOG.error("========================================================================="); LOG.error("Order Request post to Tmall failed!"); LOG.error("Marketplacestore Code: " + model.getName()); LOG.error("Error Status Code: " + httpError.getStatusCode().toString()); LOG.error("Request path: " + urlStr); LOG.error("-------------------------------------------------------------------------"); LOG.error("Failed Reason:"); LOG.error("Requested Json Ojbect is not correct!"); LOG.error("-------------------------------------------------------------------------"); LOG.error("Detail error info: " + httpError.getMessage()); LOG.error("========================================================================="); NotificationUtils.notifyUserVia(Labels.getLabel("marketplace.error.server.process.error"), NotificationEvent.Type.FAILURE, ""); } LOG.error(httpError.toString()); return; } catch (final ResourceAccessException raError) { LOG.error("========================================================================="); LOG.error("Order Request post to Tmall failed!"); LOG.error("Marketplacestore Code: " + model.getName()); LOG.error("Request path: " + urlStr); LOG.error("-------------------------------------------------------------------------"); LOG.error("Failed Reason:"); LOG.error("Order Request server access failed!"); LOG.error("-------------------------------------------------------------------------"); LOG.error("Detail error info: " + raError.getMessage()); LOG.error("========================================================================="); NotificationUtils.notifyUserVia(Labels.getLabel("marketplace.error.server.access.error"), NotificationEvent.Type.FAILURE, ""); return; } catch (final HttpServerErrorException serverError) { LOG.error("========================================================================="); LOG.error("Order Request post to Tmall failed!"); LOG.error("Marketplacestore Code: " + model.getName()); LOG.error("Request path: " + urlStr); LOG.error("-------------------------------------------------------------------------"); LOG.error("Failed Reason:"); LOG.error("Order Request server process failed!"); LOG.error("-------------------------------------------------------------------------"); LOG.error("Detail error info: " + serverError.getMessage()); LOG.error("========================================================================="); NotificationUtils.notifyUserVia(Labels.getLabel("marketplace.error.server.process.error"), NotificationEvent.Type.FAILURE, ""); return; } catch (final Exception e) { LOG.error("========================================================================="); LOG.error("Order Request failed!"); LOG.error("Marketplacestore Code: " + model.getName()); LOG.error("Request path: " + urlStr); LOG.error("-------------------------------------------------------------------------"); LOG.error("Failed Reason:"); LOG.error("Order Request server process failed!"); LOG.error("-------------------------------------------------------------------------"); LOG.error("Detail error info: " + e.getMessage()); LOG.error("========================================================================="); NotificationUtils.notifyUserVia(Labels.getLabel("marketplace.refund.requestorder.fail"), NotificationEvent.Type.FAILURE, ""); return; } NotificationUtils.notifyUserVia(Labels.getLabel("marketplace.refund.requestorder.success"), NotificationEvent.Type.SUCCESS, ""); }
From source file:com.cognitect.transit.TransitMPTest.java
private SimpleDateFormat formatter(String formatString) { SimpleDateFormat df = new SimpleDateFormat(formatString); df.setTimeZone(java.util.TimeZone.getTimeZone("UTC")); return df;// ww w .j a v a 2 s . c o m }
From source file:contestWebsite.Registration.java
@Override public void doGet(HttpServletRequest req, HttpServletResponse resp) throws IOException { VelocityEngine ve = new VelocityEngine(); ve.setProperty(RuntimeConstants.FILE_RESOURCE_LOADER_PATH, "html/pages, html/snippets"); ve.init();//from ww w .j a v a 2 s . c o m VelocityContext context = new VelocityContext(); Pair<Entity, UserCookie> infoAndCookie = init(context, req); boolean loggedIn = (boolean) context.get("loggedIn"); if (loggedIn && !infoAndCookie.y.isAdmin()) { context.put("registrationError", "You are already registered."); } SimpleDateFormat dateFormat = new SimpleDateFormat("MM/dd/yyyy"); dateFormat.setTimeZone(TimeZone.getTimeZone("GMT+6")); String endDateStr = dateFormat.format(new Date()); String startDateStr = dateFormat.format(new Date()); Entity contestInfo = infoAndCookie.x; if (contestInfo != null) { endDateStr = (String) contestInfo.getProperty("endDate"); startDateStr = (String) contestInfo.getProperty("startDate"); Date endDate = new Date(); Date startDate = new Date(); try { endDate = dateFormat.parse(endDateStr); startDate = dateFormat.parse(startDateStr); } catch (ParseException e) { e.printStackTrace(); resp.sendError(HttpServletResponse.SC_INTERNAL_SERVER_ERROR, "Incorrect date format"); } if (loggedIn && infoAndCookie.y.isAdmin()) { context.put("registrationError", ""); } else if (new Date().after(endDate) || new Date().before(startDate)) { context.put("registrationError", "Registration is closed, please try again next year."); } else { context.put("registrationError", ""); } context.put("price", contestInfo.getProperty("price")); context.put("classificationQuestion", contestInfo.getProperty("classificationQuestion")); context.put("publicKey", contestInfo.getProperty("publicKey")); } else { context.put("registrationError", "Registration is closed, please try again next year."); context.put("price", 5); } HttpSession sess = req.getSession(true); sess.setAttribute("nocaptcha", loggedIn && infoAndCookie.y.isAdmin()); context.put("nocaptcha", loggedIn && infoAndCookie.y.isAdmin()); String userError = req.getParameter("userError"); String passwordError = req.getParameter("passwordError"); String captchaError = req.getParameter("captchaError"); if (sess != null && (userError + passwordError + captchaError).contains("1")) { context.put("coach".equals(sess.getAttribute("registrationType")) ? "coach" : "student", true); context.put("account", "yes".equals(sess.getAttribute("account"))); String[] propNames = { "schoolName", "name", "email", "updated", "classification", "studentData", "schoolLevel" }; for (String propName : propNames) { context.put(propName, sess.getAttribute(propName)); } } else { context.put("account", true); context.put("schoolName", ""); context.put("name", ""); context.put("email", ""); context.put("studentData", "[]"); } if ("1".equals(req.getParameter("updated"))) { context.put("updated", true); if (sess != null) { Map<String, Object> props = (Map<String, Object>) sess.getAttribute("props"); if (props != null) { ArrayList<String> regData = new ArrayList<String>(); for (Entry<String, Object> prop : props.entrySet()) { String key = prop.getKey(); if (!key.equals("account") && PropNames.names.get(key) != null) { regData.add( "<dt>" + PropNames.names.get(key) + "</dt>\n<dd>" + prop.getValue() + "</dd>"); } } Collections.sort(regData); context.put("regData", regData); context.put("studentData", sess.getAttribute("studentData")); sess.invalidate(); } } } context.put("userError", userError); context.put("passwordError", passwordError); context.put("captchaError", captchaError); if (userError != null || passwordError != null || captchaError != null) { context.put("error", true); } context.put("Level", Level.class); close(context, ve.getTemplate("registration.html"), resp); }
From source file:com.ibm.xsp.webdav.DavXMLResponse.java
public void dateTagForCreateDate(String TagName, Date date) { if (date == null) { // return; date = new Date(); }// w ww . j a v a 2s. c o m // "2005-08-10T10:19:24Z"; String creatFormat = "yyyy'-'MM'-'d'T0'H':'m':'s'Z'"; SimpleDateFormat fmt = new SimpleDateFormat(creatFormat, DAV_LOCALE); fmt.setTimeZone(TimeZone.getTimeZone("GMT")); String datestring = fmt.format(date); this.simpleTag(TagName, datestring); }
From source file:com.ibm.xsp.webdav.DavXMLResponse.java
public void dateTag(String TagName, Date date) { if (date == null) { date = new Date(); // return; }/*from w w w . ja v a2 s . c o m*/ // "Sat, 26 Mar 2005 11:22:20 GMT"; String lastmodFormat = "EE', 'd' 'MMM' 'yyyy' 'H':'m':'s' 'z"; SimpleDateFormat fmt = new SimpleDateFormat(lastmodFormat, DAV_LOCALE); fmt.setTimeZone(TimeZone.getTimeZone("GMT")); String datestring = fmt.format(date); this.simpleTag(TagName, datestring); }