I am trying to format current time to yyyy-mm-dd'T'HH:59:59 but in dataweave 2.0 getting below exception for 'T'.
Below is my dataweave code:
StopDate: now() as String{format: 'yyyy-mm-dd'T'HH:59:59'}
Message : "org.mule.weave.v2.parser.exception.ParseException: Unable to resolve variable T
{StopDate: (currentTimeStamp) as String{format: 'yyyy-mm-dd'T'HH:59:59'}}), ^" evaluating expression: "%dw 2.0
I am new to Mule4, please guide
It is because you are using single quotes ' ' within single quotes.
You can either change it so they are single quotes within double quotes:
{StopDate: (currentTimeStamp) as String{format: "yyyy-mm-dd'T'HH:59:59"}}
Or escape the quotes:
{StopDate: (currentTimeStamp) as String{format: 'yyyy-mm-dd\'T\'HH:59:59'}}