1,501
edits
(4 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
This article gives some tips and examples for outputting dates in [[:Category: | This article gives some tips and examples for outputting dates in [[:Category:About_EasyLanguage|EasyLanguage]]. | ||
== Relevant EasyLanguage Date reserved words == | |||
Just as a reminder, the following Date reserved words are often used in working with dates: | |||
* <code><b>[[Date]]</b></code>, 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]]</b></code>, returns the current computer date in ''YYYMMdd'' format. | |||
* <code><b>[[ELDateToDateTime]]</b></code>, 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. | |||
== Outputting the date == | == Outputting the date == | ||
The following example prints the current date to the [[PowerLanguage Editor]] log: | The following example prints the current date to the [[Editor_Overview|PowerLanguage Editor]] log: | ||
<syntaxhighlight> | <syntaxhighlight> | ||
Print("The current date is: ", CurrentDate); | Print("The current date is: ", CurrentDate); | ||
Line 11: | Line 19: | ||
Which returns the following sentence: ''The current date is: 1120127.00''. | Which returns the following sentence: ''The current date is: 1120127.00''. | ||
To output the date in a more readable format, the reserved word [[FormatDate]] 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 [[ELDateToDateTime]] reserved word. | To output the date in a more readable format, the reserved word <code><b>[[FormatDate]]</b></code> 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]]</b></code> reserved word. | ||
The code example below shows in detail which steps needs to be made. | The code example below shows in detail which steps needs to be made. | ||
Line 51: | Line 59: | ||
== Outputting the date in different formats == | == Outputting the date in different formats == | ||
The [[FormatDate]] reserved word has a parameter string by which different date outputs can be generated. For example, in the code above we used | The <code><b>[[FormatDate]]</b></code> 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 [[FormatDate]] article for an extensive list of parameter options). | The code example below shows some of these parameter options for FormatDate (see the <code><b>[[FormatDate]]</b></code> article for an extensive list of parameter options). | ||
<syntaxhighlight> | <syntaxhighlight> |