From Clomosy Docs

(Created page with " procedure DecodeTime(const SourceDateTime TclDateTime; out Hour, Min, Sec, MSec Word); The DecodeTime procedure extracts the hours, minutes, seconds, and milliseconds from a given TclDateTime type value.<br> It stores the values ​​in output variables: Hour, Min, Sec and MSec. '''Example:'''<br> '''var''' myHour, myMin, mySec, myMilli : Word;<br> '''begin''' DecodeTime(Now, myHour, myMin, mySec, myMilli); ShowMessage('Time now = '+TimeToStr(Now)); Sh...")
 
No edit summary
Line 1: Line 1:
procedure DecodeTime(const SourceDateTime TclDateTime; out Hour, Min, Sec, MSec Word);
<div class="alert alert-ligth border border-3 border-primary-subtle rounded-5 p-4 shadow-sm" role="alert">
procedure DecodeTime(const DateTime: TclDateTime; var Hour, Min, Sec, MSec: Word);
</div>
 
The DecodeTime procedure extracts the hours, minutes, seconds, and milliseconds from a given TclDateTime type value.<br>
The DecodeTime procedure extracts the hours, minutes, seconds, and milliseconds from a given TclDateTime type value.<br>
   
   
It stores the values ​​in output variables: Hour, Min, Sec and MSec.
It stores the values ​​in output variables: Hour, Min, Sec and MSec.


'''Example:'''<br>
<b>Example</b><br>
'''var'''
<b>TRObject Syntax</b><br>
  myHour, myMin, mySec, myMilli : Word;<br>
<pre>
'''begin'''
var
  DecodeTime(Now, myHour, myMin, mySec, myMilli);
  myHour, myMin, mySec, myMilli : Word;
  ShowMessage('Time now = '+TimeToStr(Now));
 
  ShowMessage('Hour    = '+IntToStr(myHour));
{
  ShowMessage('Minute  = '+IntToStr(myMin));
  DecodeTime(Now, myHour, myMin, mySec, myMilli);
  ShowMessage('Second  = '+IntToStr(mySec));
  ShowMessage('Time now = '+TimeToStr(Now));
  ShowMessage('MilliSec = '+IntToStr(myMilli));
  ShowMessage('Hour    = '+IntToStr(myHour));
'''end;'''
  ShowMessage('Minute  = '+IntToStr(myMin));
  ShowMessage('Second  = '+IntToStr(mySec));
  ShowMessage('MilliSec = '+IntToStr(myMilli));
}
</pre>
<b>Base Syntax</b><br>
<pre>
var
  myHour, myMin, mySec, myMilli : Word;
 
begin
  DecodeTime(Now, myHour, myMin, mySec, myMilli);
  ShowMessage('Time now = '+TimeToStr(Now));
  ShowMessage('Hour    = '+IntToStr(myHour));
  ShowMessage('Minute  = '+IntToStr(myMin));
  ShowMessage('Second  = '+IntToStr(mySec));
  ShowMessage('MilliSec = '+IntToStr(myMilli));
end;
</pre>
 
<b>Output:</b><br>
<div class="alert alert-success" role="alert" data-bs-theme="light">
Time Now = 16:02:07<br>
Hour = 16<br>
Minute = 2<br>
Second = 7<br>
MilliSec = 807
</div>


'''Output:'''<br>
<h2> See Also </h2>
Time Now = 16:02:07
* [[System_Library#Date_and_Time_Functions | Date and Time Functions]]
Hour = 16
Minute = 2
Second = 7
MilliSec = 807

Revision as of 08:14, 8 October 2024

The DecodeTime procedure extracts the hours, minutes, seconds, and milliseconds from a given TclDateTime type value.

It stores the values ​​in output variables: Hour, Min, Sec and MSec.

Example
TRObject Syntax

var
  myHour, myMin, mySec, myMilli : Word;

{
  DecodeTime(Now, myHour, myMin, mySec, myMilli);
  ShowMessage('Time now = '+TimeToStr(Now));
  ShowMessage('Hour     = '+IntToStr(myHour));
  ShowMessage('Minute   = '+IntToStr(myMin));
  ShowMessage('Second   = '+IntToStr(mySec));
  ShowMessage('MilliSec = '+IntToStr(myMilli));
}

Base Syntax

var
  myHour, myMin, mySec, myMilli : Word;

begin
  DecodeTime(Now, myHour, myMin, mySec, myMilli);
  ShowMessage('Time now = '+TimeToStr(Now));
  ShowMessage('Hour     = '+IntToStr(myHour));
  ShowMessage('Minute   = '+IntToStr(myMin));
  ShowMessage('Second   = '+IntToStr(mySec));
  ShowMessage('MilliSec = '+IntToStr(myMilli));
end;

Output:

See Also