Skip to main content
17-Peridot
Oct 22, 2021 2:53 PM UTC
Question

Mashup parameter

I am passing mashup parameter with base type of "DateTime". Now i want to remove milliseconds from Time. Now how to format the DateTime of mashup parameter?? If i used any custom services, the output is coming wrong all the times. So i need to change the formatting property of DateTime mashup parameter. 

6 replies

22-Sapphire I
Oct 25, 2021 1:16 PM UTC

You can use an expression widget to remove milliseconds if it has to be client side.

However if you do it in a service on the server, what is coming out 'wrong'?

Translate
12-Amethyst
Oct 26, 2021 1:02 PM UTC

Hi, @AP_9587236,

So I can better understand your use case are you trying to display the mashup parameter in a mashup ( with formatting ) and also use the same mashup parameter in a service on the same mashup?

 

Thanks,

 

Travis

Translate
17-Peridot
Oct 27, 2021 11:45 AM UTC

Yes you are correct. When iam receiving value from mashup parameter(datetime), i want the datetime to be formatted without milliseconds.  

Translate
12-Amethyst
Oct 27, 2021 12:42 PM UTC

Hi @AP_9587236 ,

 

You will need an expression Function as Pai mentioned that takes in the date time parameter and formats it.  Here is a simple example of the expression code that can be bound to a display widget ( label 😞

Output = "Expression time - " + dateIn.toLocaleString('en-US');

I am not sure what you mean by comes out wrong in the service but you should pass in the mashup parameter to your target service so the original provided date is unmodified.

 

I have attached two screen shots, one showing my mashup bindings where I call the expression and a service to add minutes.  The second screen shot is my runtime where you can see the original start time ( now minus 10 minutes ).  Then a service that runs adding user defined minutes.  Here you can see only time minutes change and the milliseconds are not lost.

 

Thanks,

 

Travis

Translate