Dukascopy
 
 
Wiki JStore Search Login

Datum nach Long, Parse, ParseException
 Post subject: Datum nach Long, Parse, ParseException Post rating: 0   New post Posted: Wed 19 Nov, 2014, 13:14 

User rating: 0
Joined: Wed 19 Nov, 2014, 12:49
Posts: 1
Location: Germany, Karlsruhe
Hallo,

das hier kam meiner Frage schon nahe:
viewtopic.php?f=88&t=43723&p=56952&hilit=parse+date#p56952
Aber auch damit bekomme ich dieselbe Fehlermeldung "Unhandled exception type ParseException".

Bitte helfen Sie mir:
Wo steckt im Code unten der Fehler?
Für die Zeile
dt = df.parse("2014-11-19 09:30");
bekomme ich
die Meldung "Unhandled exception type ParseException".

Vielen Dank,

Jan-C. Weihgold


package jforex.strategies.sdk;

import java.util.*;
import java.text.*;
import com.dukascopy.api.*;


public class DateParseTest implements IStrategy {



private IChart chart;
private IHistory history;
private IConsole console;


@Override
public void onStart(IContext context) throws JFException {

IConsole c = context.getConsole();

Date dt = new Date();
// Festlegung des Formats:
SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm");
df.setTimeZone( TimeZone.getDefault() ); // nicht mehr unbedingt notwendig seit JDK 1.2
// Formatierung zu String:
c.getInfo().println( "Date = " + df.format( dt ) ); // z.B. '2001-01-26 19:03:56.731'

// Einlesen vom String:
dt = df.parse("2014-11-19 09:30");
c.getInfo().println( "parse = " + df.format( dt ) ); // z.B. '2001-02-03 04:05:06.7'

/* DateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss") {{ setTimeZone(TimeZone.getTimeZone("GMT 0")); }};
Calendar calendar = Calendar.getInstance();
System.out.println(String.format("...",
TimeZone.getDefault().getDisplayName(), // 1
calendar.getTime(), // 2
formatter.format(calendar.getTime()), // 3
formatter.parse(formatter.format(calendar.getTime())))); // 4
*/
}

@Override
public void onTick(Instrument instrument, ITick tick) throws JFException {}
@Override
public void onBar(Instrument instrument, Period period, IBar askBar, IBar bidBar) throws JFException {}
@Override
public void onMessage(IMessage message) throws JFException {}
@Override
public void onAccount(IAccount account) throws JFException {}
@Override
public void onStop() throws JFException {}

}


 
 Post subject: Re: Datum nach Long, Parse, ParseException Post rating: 0   New post Posted: Mon 24 Nov, 2014, 12:02 
Visual JForex expert at Dukascopy

User rating: 1
Joined: Wed 06 Aug, 2014, 15:28
Posts: 25
Location: LatviaLatvia
Hallo,

vielen Dank für Ihre Frage.
Diese Forum-Abschnitt ist für "Visual JForex" Fragen und leider kann ich Ihnen beim Java programmieren nicht viel helfen.
Bitte stellen Sie diese Frage im Forum-Abschnitt: Dukascopy Support Board - Automated Trading.
Mein Kollege (Englischsprachig) wird Ihnen dabei helfen.


 

Jump to:  

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