Timestamp format in IS

Hi,

I’m getting a date (10-Nov-02) from Oracle. In IS 4.6, it is 2002-11-10 00:00:00.0 (i.e. with milliseconds). I don’t want the millisecond info. (without writing a java service to discard the millisecond info) Is there any parameter wherein I can set the Timestamp format for IS 4.6?

Thanx
RK

You can use the webMethods Built-In Service pub.date:dateTimeFormat.

Your Service In parameters should be as follows:

    []inString – The date string in the pipeline []currentPattern – yyyy-MM-dd HH:mm:ss.S [*]newPattern – yyyy-MM-dd HH:mm:ss
    [/list]

    The Service Out variable value will hold the properly formatted date string.

Thanks Dan… I’m currently using pub.date:dateTimeFormat built-in service. But, I need to use this service everytime I encounter a date field. Is there any way to avoid this transformation by setting a format at one place?

RK

Try leaving the variables in the pipeline. Provided you do not overwrite them in your Flow, you will have currentPattern and newPattern available for mapping anytime.

Or, you could revise your SQL statement to select the DATE object in the proper format.

Try: SELECT TO_CHAR(COLUMNNAME,‘MM/DD/YY hh:MI:SS AM’) AS NEWCOLUMNNAME FROM TABLE

You have two alternatives that will work:

  1. Use a profile to manage the pattern and/or other static data (harder, read current article in eZine).

  2. Write your own “getMyDate” flow service. Very easy.
    a. Create empty flow service.
    b. Create map step. Instantiate a variable there and enter the pattern in the map.
    c. Call the pub.date:dateTimeFormat.

Alternatively, you can set the variable, add another map flow and use a transformer.

Hope this helps.

Ray

Thanks Dan and Ray for your responses… I’ll reformat the sql as suggested by Dan.

RK

What is the type of the column you’re retrieving?

Java format objects can have threading issues (they are inherently prone to re-entrance problems). Using string manipulation may be the better choice here.

pub.string:substring(begin=0, end=10)