简体   繁体   English

ule子数据映射日期时间转换未显示小时

[英]Mule data mapping date time conversion not showing hours

I have a date value of 2016-04-06-06:00 coming from one system and I need to map it to a string field. 我的日期值是2016-04-06-06:00,来自一个系统,我需要将其映射到字符串字段。

I'm trying to use output.DateStr = date2str(input.myDate,"yyyy-MM-dd-hh:mm"); 我正在尝试使用output.DateStr = date2str(input.myDate,"yyyy-MM-dd-hh:mm"); in the data mapping script but the DateStr field shows 2016-04-06-12:00 在数据映射脚本中,但DateStr字段显示2016-04-06-12:00

I have also tried "yyyy-MM-dd-HH:mm" but this comes through as 2016-04-06-00:00 我也尝试过"yyyy-MM-dd-HH:mm"但这是通过2016-04-06-00:00

Does anyone know how I can fix this? 有谁知道我该如何解决?

try somtehing like : 尝试somtehing像:

DateFormat df = new SimpleDateFormat("yyyy-MM-/dd-HH:mm");

//DateFormat format method create a string 

String reportDate = df.format(yourDate);

I hope it helps. 希望对您有所帮助。

Try this: 尝试这个:

#[dateString = new java.util.Date().toString();
  payload = new org.mule.el.datetime.DateTime(dateString, 'yyyy-MM-dd-hh:mm');]

change dateString as '2016-04-06-06:00'. 将dateString更改为'2016-04-06-06:00'。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM