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
 
(3 intermediate revisions by 2 users not shown)
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'''
 
  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>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
{{#seo:|title=DecodeTime Using in Clomosy - Clomosy Docs}}
Minute = 2
{{#seo:|description=DecodeTime extracts hours, minutes, seconds, and milliseconds from a TclDateTime value and stores them in specified variables for easy time manipulation.}}
Second = 7
MilliSec = 807

Latest revision as of 14:01, 24 December 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

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));
}

Output:

See Also