【问题标题】:Convert String to date using Datawave Mule使用 Datawave Mule 将字符串转换为日期
【发布时间】:2017-05-10 09:59:51
【问题描述】:

我想使用 datawave mule 将字符串“2016-04-09”转换为日期,有什么想法吗?

当我使用时:

%dw 1.0
%output application/json
---
{
  d1: "2016-04-09" as :date
}

我得到SUN Mar 09 00:00:00 CET 2016 作为结果,但我想要'2016-04-09' 日期类型而不是

【问题讨论】:

    标签: string date type-conversion mule


    【解决方案1】:

    尝试使用以下表达式,

    foo: "2016-04-09" as :date {class : "java.util.Calendar", format : "yyyy-MM-dd"}
    

    【讨论】:

      【解决方案2】:

      我们开始:

      %dw 1.0
      %output application/json
      ---
      {
          foo: "2016-04-09" as :date
      }
      

      也看看documentation

      【讨论】:

      • 输出不是我想要的:(,我得到了这样的结果“SUN Mar 09 00:00:00 CET 2016”但我想要这样的结果“2016-04-09 " 输入日期不是字符串
      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2015-04-27
      • 2011-11-28
      • 2018-03-09
      • 2015-08-24
      • 2017-01-07
      • 2019-10-27
      相关资源
      最近更新 更多