HowTo: Delphi TDateTime conversion into C++ time

How to create strategies and indicators
Message
Author
Wessel
Posts: 63
Joined: Tue Oct 12, 2010 6:45 pm

HowTo: Delphi TDateTime conversion into C++ time

#1 Postby Wessel » Wed Feb 16, 2011 5:45 pm

Hi,

For those people who like to decompose the TDateTime object as it is returned by Time and iTime into something useful in C++ use the following calls to convert this COledatetime object into something civil:

Code: Select all



SYSTEMTIME mytime;
VariantTimeToSystemTime( iTime(symbol, timeFrame, iUp+1), &mytime);

Now mytime is a structure the details can be found here:

http://msdn.microsoft.com/en-us/library/ms724950%28v=vs.85%29.aspx

Code: Select all

typedef struct _SYSTEMTIME {
  WORD wYear;
  WORD wMonth;
  WORD wDayOfWeek;
  WORD wDay;
  WORD wHour;
  WORD wMinute;
  WORD wSecond;
  WORD wMilliseconds;
} SYSTEMTIME, *PSYSTEMTIME;


Hope this helps others to make the conversion, took me way to long to figure this out.

Wessel
Last edited by Wessel on Mon Feb 21, 2011 6:15 pm, edited 1 time in total.

FT Support
Posts: 905
Joined: Sat Jul 11, 2009 10:54 am

#2 Postby FT Support » Thu Feb 17, 2011 2:09 pm

Wessel, Thank you for posting this!
Check our other product here:
http://www.forexcopier.com


Return to “FT API”

Who is online

Users browsing this forum: No registered users and 25 guests