Datetime.SetTime

Parent Previous Next

Datetime.SetTime.

Inserts the specified time into the current instance while preserving the date. If the instance was previously empty, date is implicit set to today. Returns Self for a possible continuation of operations.



Syntax.


 SetTime(Integer hour, minute, second, millisec) : <Self>

 


Arguments:

Argument

Value range

hour

minute

second

millisec

0 .. 23

0 .. 59

0 .. 59

0 .. 999


Example:


 //Let's assume today is 30/7-1999.

 Datetime dtMy.SetTime(23, 50, 7, 0);

 String s := dtMy.ToString();  //Now s == "19990730 23:50:07.000";


 dtMy.SetDate(2050, 2, 15);

 s := dtMy.ToString();         //Now s == "20500215 23:50:07.000";


 dtMy.SetTime(23, 59, 47, 98); //Preserves the date.

 s := dtMy.ToString();         //Now s == "20500215 23:59:47.098";