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.

Execution only after a certain Date and Time
 Post subject: Execution only after a certain Date and Time Post rating: 0   New post Posted: Sun 04 Jun, 2017, 12:21 
User avatar

User rating: 0
Joined: Tue 06 Sep, 2016, 11:04
Posts: 20
Location: United Kingdom,
Hi,

Say I want to execute something inside onTick but only at or after a certain date and time. Example: after 15.06.2017, 15:30:59.

How can I do it?
Please show the exact if statement I need to use.

Thanks


 
 Post subject: Re: Execution only after a certain Date and Time Post rating: 0   New post Posted: Tue 06 Jun, 2017, 06:29 
User avatar

User rating: 0
Joined: Tue 06 Sep, 2016, 11:04
Posts: 20
Location: United Kingdom,
I see nobody get answers here.

Nobody care about this forum?


 
 Post subject: Re: Execution only after a certain Date and Time Post rating: 0   New post Posted: Fri 07 Jul, 2017, 18:59 

User rating: 0
Joined: Tue 15 Sep, 2015, 20:14
Posts: 4
Location: Poland,
private Boolean validTimeOfOrder (long time)
{
Boolean ret = false;
Calendar calendarNow = Calendar.getInstance();
Calendar calendarFrom = Calendar.getInstance();
Calendar calendarTo = Calendar.getInstance();

calendarNow.setTimeInMillis(time);
int year = calendarNow.get(Calendar.YEAR);
int month = calendarNow.get(Calendar.MONTH) + 1; // Note: zero based!
int day = calendarNow.get(Calendar.DAY_OF_MONTH);

calendarFrom.set(year, month - 1, day, 5, 29, 59);
calendarTo.set(year, month - 1, day, 22, 30, 00);

if (calendarNow.getTime().getTime() < calendarTo.getTime().getTime()
&& calendarNow.getTime().getTime() > calendarFrom.getTime().getTime())
{
// handel tylko w dni powszedne
if (day != Calendar.SATURDAY && day != Calendar.SUNDAY)
{
ret = true;
}
}

return ret;
}


 

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