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.

Timestamp
 Post subject: Timestamp Post rating: 0   New post Posted: Wed 18 Sep, 2013, 15:47 
User avatar

User rating: 0
Joined: Tue 28 May, 2013, 16:00
Posts: 37
Location: Hungary, Győr
Hi!
How can i the argument_1 and 2 date time code change to normal date formatum? ("yyyy-MM-dd HH:mm:ss.SSS")
how can i use the SimpleDateFormat ?
where to write?

long argument_1 = 1378159200000l;
long argument_2 = LastTick.getTime();
long argument_3 = 1378159200000l;
if (argument_1< argument_2) {
}
if (!(argument_1> argument_2 && argument_1< argument_2 ) ) {
If_block_33(flow);
}
else if (argument_1== argument_2) {
}

Thank you!


 
 Post subject: Re: Timestamp Post rating: 0   New post Posted: Wed 18 Sep, 2013, 15:51 
User avatar

User rating:
Joined: Fri 31 Aug, 2007, 09:17
Posts: 6139
use DateUtils.format, see:
https://www.dukascopy.com/wiki/#IConsole/Logging_values
Locate there the place about time formatting. If you wish to use other time formatting, see:
https://www.dukascopy.com/wiki/#Format_Date_Time


 
 Post subject: Re: Timestamp Post rating: 0   New post Posted: Wed 18 Sep, 2013, 16:05 
User avatar

User rating: 0
Joined: Tue 28 May, 2013, 16:00
Posts: 37
Location: Hungary, Győr
can you write a for example? please :oops:


 
 Post subject: Re: Timestamp Post rating: 1   New post Posted: Wed 18 Sep, 2013, 20:04 
User avatar

User rating: 164
Joined: Mon 08 Oct, 2012, 10:35
Posts: 676
Location: NetherlandsNetherlands
Well, the linked wiki pages contain examples...

But if they are not clear:
For comparison just use the data as it is. Leave it long (like 1378159200000), as it can be compared.
If you want to see/check what is the 'real' date behind this millisecond value, use SimpleDateFormat:
long argument_1 = 1378159200000l;
private SimpleDateFormat sdf;
sdf = new SimpleDateFormat("yyyy-MM-dd_HHmmss");   // but the format can be whatever you prefer
sdf.setTimeZone(TimeZone.getTimeZone("GMT"));
console.getOut().println(sdf.format(argument_1));


If you really need a complete strategy, look around on the wiki. There are plenty of examples where the SimpleDateFormat is used (for example here).

Good luck!


 

Jump to:  

cron
  © 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