Dukascopy
 
 
Wiki JStore Search Login

Attention! Read the forum rules carefully before posting a topic.

    Try to find an answer in Wiki before asking a question.
    Submit programming questions in this forum only.
    Off topics are strictly forbidden.

Any topics which do not satisfy these rules will be deleted.

IOrder.getFillTime()
 Post subject: IOrder.getFillTime() Post rating: 0   New post Posted: Sun 10 Apr, 2016, 06:04 
User avatar

User rating: 0
Joined: Mon 19 Oct, 2015, 16:28
Posts: 6
Location: Canada,
what units are these? How can I convert it to LocalDateTime?


 
 Post subject: Re: IOrder.getFillTime() Post rating: 0   New post Posted: Tue 12 Apr, 2016, 12:28 
User avatar

User rating:
Joined: Fri 31 Aug, 2007, 09:17
Posts: 6139
Hello,
ycomp wrote:
what units are these?

This method returns long which specifies time in milliseconds. So, the units are milliseconds.

ycomp wrote:
How can I convert it to LocalDateTime?

Unfortunately, our platform doesn't support Java 8 yet.

At this point, we have two options:

1) See example below for getting date using Java 7 and JForex API

2)Take a look on third party libraries that could make it

Good luck and have a nice day

import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.GregorianCalendar;
import java.util.TimeZone;

    public void times(IOrder order) {
        long time = order.getFillTime();
        console.getOut().println(toStr(time));

        Calendar cal = new GregorianCalendar();
        cal.setTimeZone(TimeZone.getTimeZone("GMT"));
        cal.setTimeInMillis(time);
    }

    public String toStr(long time) {
        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss") {
            {
                setTimeZone(TimeZone.getTimeZone("GMT"));
            }
        };
        return sdf.format(time);
    }


 

Jump to:  

  © 1998-2025 Dukascopy® Bank SA
On-line Currency forex trading with Swiss Forex Broker - ECN Forex Brokerage,
Managed Forex Accounts, introducing forex brokers, Currency Forex Data Feed and News
Currency Forex Trading Platform provided on-line by Dukascopy.com