question

Upvotes
Accepted
16 0 0 2

Inquiry about the inter-day problem of converting Reuters date to Beijing date

The exchange rate quotes sent by Reuters have separate date fields for askdate and biddate;

When using the toDate() method of the RFA api to convert these two times to Beijing time, no 1 is added in the case of inter-day.

For example, if a "EUR=" rate quote is sent on 2023-03-21 23:00:00 GMT.

The value of the askdate field is 2023-03-21, which should be 2023-03-22 when converted to BST.

But the current date after conversion is still 2023-03-21

The conversion code is shown below:

  
                
  • OMMData data = entry.getData(def.getOMMType());
  •         OMMDateTime dt = (OMMDateTime)data;
  •         // Since the date field does not carry a time, the default is 00:00:00
  •         // So when the time sent by Reuters is converted to Beijing time,
  •         // the date will never cross the day
  •         Date date = dt.toDate();
#technologyrfarfa-api
icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

@zero

Hi,

Thank you for your participation in the forum.

Is the reply below satisfactory in answering your question?

If yes please click the 'Accept' text next to the reply. This will guide all community members who have a similar question.

Otherwise please post again offering further insight into your question.

Thanks,

AHS

Please be informed that a reply has been verified as correct in answering the question, and has been marked as such.

Thanks,


AHS

Upvotes
Accepted
79.3k 253 52 74

@zero

Thanks for reaching out to us.

I checked the data and I am unable to find any field in EUR= that contains both Date and Time data.

I found the date fields that contain dates (DD MMM YYYY) and the time fields that contain times in GMT.

1679562349307.png

If you called toDate() on the date fields, you will get that date. It will not be converted to another date according to the time zone because it doesn't contain time data.

Therefore, you may need to get a time field and convert it according to your timezone. Then, if the converted time is for the next day, you need to add one to the date field.

However, if you use another field that contains both date and time, please let me know.

I hope that this information is of help



1679562349307.png (28.6 KiB)
icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Upvote
16 0 0 2

hi

@moragodkrit.chumsri_1

How to solve this problem

icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Upvotes
16 0 0 2

Thank you for your reply

icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.