Skip to main content
17-Peridot
October 22, 2021
Question

Mashup parameter

  • October 22, 2021
  • 2 replies
  • 3111 views

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. 

2 replies

22-Sapphire I
October 25, 2021

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'?

12-Amethyst
October 26, 2021

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

17-Peridot
October 27, 2021

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

12-Amethyst
October 27, 2021

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