IBM Sterling Transformation Extender

Sterling Transformation Extender

Come for answers, stay for best practices. All we're missing is you.


#Sterling
 View Only
Expand all | Collapse all

DateTime format with Milliseconds

  • 1.  DateTime format with Milliseconds

    Posted Mon November 12, 2007 05:56 AM

    Originally posted by: SystemAdmin


    Hello,
    I remember from a project that it is possible to output a date/time format with milliseconds, using the function TODATETIME() but I cannot recall the syntax: "YYMMDDHH24MMSS + something..."
    Does anyone has an idea ?

    thx!
    François
    #DataExchange
    #IBM-Websphere-Transformation-Extender
    #IBMSterlingTransformationExtender


  • 2.  Re: DateTime format with Milliseconds

    Posted Mon November 12, 2007 06:50 AM

    Originally posted by: LaurentB


    Hi François,

    the format string would be something like this {HH24MMSS3-3} (for time, add the {CCYYMMDD} before if required)

    Best regards
    Laurent
    #IBMSterlingTransformationExtender
    #IBM-Websphere-Transformation-Extender
    #DataExchange


  • 3.  Re: DateTime format with Milliseconds

    Posted Tue November 13, 2007 11:06 AM

    Originally posted by: SystemAdmin


    All the format strings are in the Functions and Expressions Reference Guide, but I don't see the entry specific to milliseconds, though I do see "fractions". I'd mess with it and see what results I got.
    #IBM-Websphere-Transformation-Extender
    #IBMSterlingTransformationExtender
    #DataExchange


  • 4.  Re: DateTime format with Milliseconds

    Posted Tue November 13, 2007 03:31 PM

    Originally posted by: SystemAdmin


    I just saw this format in a map that wasn't mine:

    {CCYYMMDDHH24MMSS0-9}

    I went into the type tree and se a random field to "time" and saw the options.

    After seconds, it has the option of "fractions" (of seconds), with a min and max drop down with the numbers 0 through 9. I did 0 and 9 and got this format:

    HH24MMSS0-9

    I'm not sure what it means off hand.

    LaurentB, can you explain what the 3-3 stands for?
    #IBM-Websphere-Transformation-Extender
    #DataExchange
    #IBMSterlingTransformationExtender


  • 5.  Re: DateTime format with Milliseconds

    Posted Tue November 13, 2007 08:53 PM

    Originally posted by: nexusis


    It's fixed at one thousandth of 1 second, i.e., 1 millisecond, at min=3, max=3 after the decimal.

    HH24MMSS.123

    For UTC time, it can be set at a maximum of a microsecond, like HH24MMSS.123456.

    nexusis
    #IBMSterlingTransformationExtender
    #DataExchange
    #IBM-Websphere-Transformation-Extender


  • 6.  Re: DateTime format with Milliseconds

    Posted Thu November 15, 2007 04:06 PM

    Originally posted by: jvanboga


    For windows you won't get more than 3 ms positions = more than 0.
    #DataExchange
    #IBMSterlingTransformationExtender
    #IBM-Websphere-Transformation-Extender


  • 7.  Re: DateTime format with Milliseconds

    Posted Thu November 15, 2007 07:38 PM

    Originally posted by: nexusis


    This is a section of the target XML file generated from maps developed and compiled in Windows XP development environment, deployed to Windows OS(2003) test and production environments. The XML type trees were generated from valid .xsd schemata on Windows XP.

    <?xml version="1.0" encoding="UTF-8" ?>
    <OrderMessage>
    <TransactionInfo>
    <MessageSender>99-999-9999</MessageSender>
    <MessageRecipient>DUMMY_ORG</MessageRecipient>
    <MessageID>000000106</MessageID>
    <Created>2007-09-27T20:47:00.12345</Created>
    <FileName>ST0001_Dummy_PO_Line_Item_inputfile.edi</FileName>
    </TransactionInfo>

    The mapping rule (and there are a few ways to get this result) here:

    = TODATETIME ( LEFT ( DATETOTEXT (InterchangeDate) , 4 )
    "-" MID ( DATETOTEXT (InterchangeDate), 5 , 2)
    "-" RIGHT ( DATETOTEXT ( InterchangeDate ), 2)
    + "T" + LEFT ( TIMETOTEXT ( InterchangeTime ), 2 )
    + ":" + MID ( TIMETOTEXT ( InterchangeTime ) , 3, 2)
    + ":" + InterchangeTime_Seconds ,
    "{CCYY-MM-DD}T{HH24:MM:SS.0-6}" )

    Where InterchangeTime_Seconds is a text value = 00.12345

    You can also do a simple test with a string as input and create the XML target element defining it UTC format without GMT offset.

    = TODATETIME ( LEFT ( UTC_datetime_test , 4 )
    "-" MID ( UTC_datetime_test , 5 , 2)
    "-" MID ( UTC_datetime_test , 7 , 2)
    + "T" + MID ( UTC_datetime_test , 9, 2 )
    + ":" + MID ( UTC_datetime_test , 11, 2)
    + ":" + RIGHT ( UTC_datetime_test , 8 ) ,
    "{CCYY-MM-DD}T{HH24:MM:SS.0-6}" )

    This is the source string:

    20070927204700.12345

    <TransactionInfo>
    <MessageSender>Dummy_SenderID</MessageSender>
    <MessageRecipient>Dummy_RecipientID</MessageRecipient>
    <MessageID>MessageID</MessageID>
    <Created>2007-09-27T20:47:00.12345</Created>
    <FileName>20070927204700.12345</FileName>
    </TransactionInfo>

    The "Created" xml element was generated by WTX from a valid .xsd schema as a DateTime item with this definition:

    {CCYY-MM-DD}T{HH24:MM:SShttp://.0-6+/-ZZ:ZZ}

    nexusis
    #IBMSterlingTransformationExtender
    #IBM-Websphere-Transformation-Extender
    #DataExchange


  • 8.  Re: DateTime format with Milliseconds

    Posted Thu November 15, 2007 07:44 PM

    Originally posted by: nexusis


    "{CCYY-MM-DD}T{HH24:MM:SS.0-6+/-ZZ:ZZ}"
    #IBM-Websphere-Transformation-Extender
    #IBMSterlingTransformationExtender
    #DataExchange


  • 9.  Re: DateTime format with Milliseconds

    Posted Fri November 16, 2007 09:28 AM

    Originally posted by: jvanboga


    Sorry, wasn't clear.

    "{CCYY-MM-DD}T{HH24:MM:SS.0-6+/-ZZ:ZZ}"

    Still only gets you

    occurs time datetime time
    1 20071116 2007-11-16T08:26:20.059-0600 08:26:20.059
    2 20071116 2007-11-16T08:26:20.059-0600 08:26:20.059
    3 20071116 2007-11-16T08:26:20.059-0600 08:26:20.059
    4 20071116 2007-11-16T08:26:20.059-0600 08:26:20.059
    5 20071116 2007-11-16T08:26:20.059-0600 08:26:20.059
    6 20071116 2007-11-16T08:26:20.059-0600 08:26:20.059
    7 20071116 2007-11-16T08:26:20.059-0600 08:26:20.059
    8 20071116 2007-11-16T08:26:20.059-0600 08:26:20.059
    9 20071116 2007-11-16T08:26:20.059-0600 08:26:20.059

    No more than 3ms in windows.
    #DataExchange
    #IBMSterlingTransformationExtender
    #IBM-Websphere-Transformation-Extender


  • 10.  Re: DateTime format with Milliseconds

    Posted Fri November 16, 2007 12:09 PM

    Originally posted by: nexusis


    If you have a target (output) element defined (in an XML type tree) as DateTime with this format:

    "{CCYY-MM-DD}T{HH24:MM:SS.0-6+/-ZZ:ZZ}"

    You can generate the value for this target element in Windows:

    <Created>2007-09-27T20:47:00.12345</Created>

    Your data (is this the output of the map?)

    occurs time datetime time
    1 20071116 2007-11-16T08:26:20.059-0600 08:26:20.059

    ....looks like the target element was defined in the type tree as

    "{CCYY-MM-DD}T{HH24:MM:SS.0-3+/-ZZ:ZZ}" or
    "{CCYY-MM-DD}T{HH24:MM:SS.3-3+/-ZZ:ZZ}" ?

    Hmmmm.. Don't know what happen here with your type tree.

    We are able to get UTC format up to SS.nnnnnn plus the GMT (zulu) offset running in Windows.
    #IBM-Websphere-Transformation-Extender
    #IBMSterlingTransformationExtender
    #DataExchange


  • 11.  Re: DateTime format with Milliseconds

    Posted Fri November 16, 2007 01:57 PM

    Originally posted by: jvanboga


    This might be a bios issue. I ran this tree in XP and 2003 Server, using both v6.7 and 8.1.

    I spoke with our tech services area a while back that the windows machines would only produce up to 4 bytes for mil-secs. I've never gotten more.
    #IBMSterlingTransformationExtender
    #IBM-Websphere-Transformation-Extender
    #DataExchange


  • 12.  Re: DateTime format with Milliseconds

    Posted Mon April 13, 2015 11:09 AM

    Originally posted by: hanishkola


    I want to convert my DATETIME 2014-12-10 09:14:24.526   to   2014121010

    tell me how?

     

     

     


    #IBMSterlingTransformationExtender
    #IBM-Websphere-Transformation-Extender
    #DataExchange


  • 13.  Re: DateTime format with Milliseconds

    Posted Mon April 13, 2015 03:38 PM

    Originally posted by: Arun Ramamurthy


    Assuming you mean to 20141210 , you can use the FromDatetime or ToDatetime functions as below.

    FROMDATETIME(test ,"{CCYYMMDD}")

    Please review the WTX documentation for more on these functions.

    http://www-01.ibm.com/support/knowledgecenter/#!/SSVSD8_8.4.1/com.ibm.websphere.dtx.funcexp.doc/references/r_funcs_express_FROMDATETIME.htm?cp=SSVSD8_8.4.1%2F21-9-8


    #IBM-Websphere-Transformation-Extender
    #DataExchange
    #IBMSterlingTransformationExtender