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);
}