Search code examples
webmethods

What transformer can I use to put a date into YYYY - MM - DD format with no time format in final result?


I just started using webMETHODS today and need to transform a date input value that comes in like this.

Example:

yyyy-mm-dd hh:mm:ss:hh

I need just the date portion of this variable and am currently using pub.date:formatDate which will crash my flow service.

What should I be using?

This is what I see on my WEBMethods screen!


Solution

  • pub.date:formatDate is used to convert a date input to a string output based on a string pattern. Here you are trying to convert a string input to a string output.

    You have to do the following: a. First convert the string (Process_date_orig_str) to date format (Process_date_dt) b. Then use the date (Process_date_dt) to the required string format using pub.date:formatDate to get (Process_date_new_str)

    Note: You will have to create your custom java service to convert string to Date.