[英]how to format month/day for 2 digits in mule4?
我试图以月/日期格式在 s3 中创建我的文件名。 我不希望 May 被打印为 5。它必须是 '05' 我试过了
now().month as Number {format: "00"}
和
now().month as Number {format: "##"}
两者都打印5 。 不像05 。
<set-variable value="#[now().year ++ '/' ++ now().month as Number {format: "00"}++ '/'++ now().day as Number {format: "##"} ++'/'++ now() as String {format: "yyyyMMdd_HHmmss"} ++".json"]" doc:name="S3-filename" doc:id="ff101e31-4f6c-45f5-9669-a60fbc32204e" variableName="s3filename"/>
不要对日期、数字和字符串进行多次转换。 直接转换为字符串。 注意月份是MM(大写),分钟是mm(小写)
https://simpleflatservice.com/mule4/Date_format.html
%dw 2.0
output application/java
---
now() as String {format: "MM"}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.