×

Sign up and get MultiCharts free

Use its powerful simulation mode with data included out of the box. Just fill out the form and start honing your trading skills with a few clicks.

Changes - MultiCharts

Changes

Jump to navigation Jump to search

Outputting Dates in EasyLanguage

No change in size, 14:18, 23 February 2012
Just as a reminder, the following Date reserved words are often used in working with dates:
* <code><b>[[Date]]</codeb></bcode>, which returns the Date of the current bar in ''YYYMMdd'' format. This date format is always the format with which a date calculation starts. * <code><b>[[CurrentDate]]</codeb></bcode>, returns the current computer date in ''YYYMMdd'' format.* <code><b>[[ELDateToDateTime]]</codeb></bcode>, converts a date in ''YYmmdd'' format to a date into DateTime format.
See the [[:Category:Date_and_Time_Routines|Date & Time Routines]] for all EasyLanguage reserved words.
Which returns the following sentence: ''The current date is: 1120127.00''.
To output the date in a more readable format, the reserved word <code><b>[[FormatDate]]</codeb></bcode> is needed. However, FormatDate requires that the date is in DateTime format, while the default Date is in YYYMMdd format. So, a conversion to DateTime is needed first. This is done with the <code><b>[[ELDateToDateTime]]</codeb></bcode> reserved word.
The code example below shows in detail which steps needs to be made.
== Outputting the date in different formats ==
The <code><b>[[FormatDate]]</codeb></bcode> reserved word has a parameter string by which different date outputs can be generated. For example, in the code above we used "dd-MM-yyyy" to return "27-1-2012".
The code example below shows some of these parameter options for FormatDate (see the <code><b>[[FormatDate]]</codeb></bcode> article for an extensive list of parameter options).
<syntaxhighlight>

Navigation menu