User login

  

Conversion Functions

The following lists alphabetically built-in PTL functions used to convert values from one data type to another.

Mode for convert time from Java to .Net representation

TIME_DATE gets result as "yyyy.mm.dd"
TIME_MINUTES gets result as "hh:mm"
TIME_SECONDS gets result as "hh:mm:ss"

 

This constants can be used together. Example, TIME_DATE | TIME_SECONDS gets result as "yyyy.mm.dd hh:mm:ss"

 

Java time and .Net time

The application based on Java platform use the January 1, 1970 00:00:00.000 GMT as start point for calc time. It likes Unix/Linux system time or many other platforms (example, MQL4). But, MS .Net (and so PTL Builder) uses  the January 1, 0001 00:00:00.000 GMT as start point for calc time. So, the Java time must be converted with special functions for correct applied in .Net application.

These functions are placed in Convert package:

ColorFrom16BitColor

ColorTo16BitColor

StringToChar

TimeToDouble

TimeToStr

 

ColorFrom16BitColor

Gets a color by the specified 16bit-code

Syntax

color ColorFrom16BitColor( int value)

 

ColorTo16BitColor

Gets a 16bit-code of the specified color

Syntax

int ColorTo16BitColor( color value)

 

StringToChar

Returns first character of specified string

Syntax

char StringToChar( string value)

 

TimeToDouble

Converts datetime to double

Syntax

double  TimeToDouble( datetime value)

 

TimeToStr

Converts the Java datetime value in milliseconds to its equivalent string representation.

Syntax

string TimeToStr( datetime value, int mode)

string TimeToStr( datetime value, double mode)

Parameters

  • value - Any numeric value that represents Java time in milliseconds.
  • mode - The mode of represent result.

Example

string str;                                // str <- ""

str = TimeToStr(65688045, TIME_DATE);      // str <- "1972.01.31"

 

12345