TIME type format

Cosby
Cosby Newcomer
edited May 28 in EMA

Dear Support,

In EMA Java, the default format for data fields of type TIME is STR_DATETIME_RSSL (HH:MM:SS:XXX:YYY:ZZZ). How do we change it to ISO format STR_DATETIME_ISO8601 which lacks the ':' delimiters in the subsecond part of the format.

Thanks,

Kristen

Answers

  • Hello @Cosby

    You can specify the format type when using the format() function. Here is the description in the SDK docs -

    image.png

    And an example -

    https://github.com/Refinitiv/Real-Time-SDK/blob/master/Java/Ema/Core/src/test/java/com/refinitiv/ema/unittest/DateTimeTests.java#L104

  • Guanran
    Guanran Newcomer

    Hi Gurpreet,

    Just want to clarify the problem. We are using ema publish RefreshMsg, the payload is FieldList, we create FieldList through api EmaFactory.createFieldList(). One of the fields is Time type information, we use ema's api EmaFactory.createFieldEntry().time() to generate Field. This is successful, but we need to specify the format of this TIME externally as STR_DATETIME_ISO8601.

    If we explicitly set the format after generating the object through EmaFactory.createFieldEntry().time() api, or can I achieve this through other apis?

    Thanks,

    Guanran

  • Guanran
    Guanran Newcomer

    Could you please help us to further check the problem I add here?

  • Jirapongse
    Jirapongse ✭✭✭✭✭

    The EmaFactory.createFieldEntry().time methods support the following parameters.

    image.png

    You need to convert a time string into hours, minutes, seconds, and milliseconds, and then assign these values using the time methods.

  • Guanran
    Guanran Newcomer

    Hi,

    I think we miss each other. The thing I want to talk is not how to convert from string to a time.

    let us assume we have some code like this,

    var timeFiledEntry = EmaFactory.createFieldEntry().time(5,3,3,2,1,1,1);
    

    then the TIME object inside this timeFiledEntry is STR_DATETIME_RSSL format. But I want to set it to

    STR_DATETIME_ISO8601. is there any way to do that? or another way of the question is how can I get the internal TIME object after I have this timeFiledEntry?

    regards,

    Guanran

  • Jirapongse
    Jirapongse ✭✭✭✭✭

    @Guanran

    In EMA, decoding of just encoded object in the same application is not supported.

    The following code is used to encode a field entry object.

    var timeFiledEntry = EmaFactory.createFieldEntry().time(5,3,3,2,1,1,1);
    
    

    EMA doesn't have an interface to decode the time data after it has been encoded.

    Under the hood, we store time as integers for each unit.