From Clomosy Docs

No edit summary
No edit summary
Line 1: Line 1:
function EncodeDate(const Year, Month, Day Word):TclDateTime;
<div class="alert alert-ligth border border-3 border-primary-subtle rounded-5 p-4 shadow-sm" role="alert">
function EncodeDate(Year, Month, Day: Word):TclDateTime;
</div>


The EncodeDate function produces a TclDateTime return value from the passed Year, Month, and Day values.<br>
The EncodeDate function produces a TclDateTime return value from the passed Year, Month, and Day values.<br>
Line 8: Line 10:
Day = 1..31 (depending on month/year)<br>
Day = 1..31 (depending on month/year)<br>


'''Example:'''<br>
<b>Example</b><br>
:'''Base Syntax'''
<b>TRObject Syntax</b><br>
  var
<pre>
    myDate : TclDateTime;
var
 
  myDate : TclDateTime;
  begin
    // Set my date variable using the EncodeDate function
{
    myDate := '''EncodeDate'''(2023, 02, 27);
  // Set my date variable using the EncodeDate function
    ShowMessage('Date set to '+DateToStr(myDate));
  myDate = EncodeDate(2023, 02, 27);
  end;
  ShowMessage('Date set to '+DateToStr(myDate));
}
</pre>
<b>Base Syntax</b><br>
<pre>
var
  myDate : TclDateTime;
begin
  // Set my date variable using the EncodeDate function
  myDate := EncodeDate(2023, 02, 27);
  ShowMessage('Date set to '+DateToStr(myDate));
end;
</pre>


:'''TRObject Syntax'''
<b>Output:</b><br>
<div class="alert alert-success" role="alert" data-bs-theme="light">
Date set to 27.02.2023
</div>


  var
<h2> See Also </h2>
    myDate : TclDateTime;
* [[System_Library#Date_and_Time_Functions | Date and Time Functions]]
 
  {
    // Set my date variable using the EncodeDate function
    myDate = '''EncodeDate'''(2023, 02, 27);
    ShowMessage('Date set to '+DateToStr(myDate));
  }
 
'''Output:'''<br>
Date set to 27.02.2023

Revision as of 08:17, 8 October 2024

The EncodeDate function produces a TclDateTime return value from the passed Year, Month, and Day values.

The allowed parameter values ​​are:
Year = 2000..9999
Month = 1..12
Day = 1..31 (depending on month/year)

Example
TRObject Syntax

 var
   myDate : TclDateTime;
 
 {
   // Set my date variable using the EncodeDate function
   myDate = EncodeDate(2023, 02, 27);
   ShowMessage('Date set to '+DateToStr(myDate));
 }

Base Syntax

 var
   myDate : TclDateTime;
 
 begin
   // Set my date variable using the EncodeDate function
   myDate := EncodeDate(2023, 02, 27);
   ShowMessage('Date set to '+DateToStr(myDate));
 end;

Output:

See Also