【问题标题】:How to convert date to (iso8601) in Mule 3.2?如何在 Mule 3.2 中将日期转换为 (iso8601)?
【发布时间】:2015-09-28 22:51:44
【问题描述】:

我需要在 Mule 3.2 中转换这种日期格式 YYYY-MM-DDThh:mm:ss.sTZD (iso8601) 例如 1997-07-16T19:20:30.45+01:00

我使用 #[function:dateamp:YYYY-MM-DDThh:mm:ss.sTZD] 但是 这不起作用

【问题讨论】:

  • #[function:dateamp:yyyy-MM-dd]T#[function:dateamp:hh:mm:ss.SXXX]
  • 将此作为答案发布并接受它,这样该问题就不会显示为“仍处于打开状态”。

标签: mule mule-studio iso8601 mule-el


【解决方案1】:

真正的答案是这样的(我之前的答案是错误的):

<mule xmlns:json="http://www.mulesoft.org/schema/mule/json" xmlns:http="http://www.mulesoft.org/schema/mule/http" xmlns="http://www.mulesoft.org/schema/mule/core" xmlns:doc="http://www.mulesoft.org/schema/mule/documentation" xmlns:spring="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-current.xsd http://www.mulesoft.org/schema/mule/core http://www.mulesoft.org/schema/mule/core/current/mule.xsd http://www.mulesoft.org/schema/mule/http http://www.mulesoft.org/schema/mule/http/current/mule-http.xsd http://www.mulesoft.org/schema/mule/json http://www.mulesoft.org/schema/mule/json/current/mule-json.xsd"> <http:connector name="HTTP_HTTPS" cookieSpec="netscape" validateConnections="true" sendBufferSize="0" receiveBufferSize="0" receiveBacklog="0" clientSoTimeout="10000" serverSoTimeout="10000" socketSoLinger="0" doc:name="HTTP-HTTPS"/> <flow name="dateFlow"> <http:inbound-endpoint exchange-pattern="request-response" host="localhost" port="8089" path="serverdate" connector-ref="HTTP_HTTPS" doc:name="HTTP"/> <logger message="#[server]" level="INFO" doc:name="Logger"/> <set-payload value="#[new java.text.SimpleDateFormat(&quot;yyyy-MM-DD'T'hh:mm:ss.SSSZ&quot;).format(new java.util.Date())]" doc:name="Set Payload"/> <json:object-to-json-transformer doc:name="Object to JSON"/> </flow> </mule>

【讨论】:

  • 您能否在问题中添加此代码如何解决问题的说明?
  • 如果对您有用,请将答案标记为有用
猜你喜欢
  • 1970-01-01
  • 2023-03-16
  • 2012-07-07
  • 1970-01-01
  • 1970-01-01
  • 2011-09-21
  • 2015-01-20
  • 1970-01-01
  • 2017-05-26
相关资源
最近更新 更多