;------------------------------------------------------------------------------------------------------------------------------------------ #DefineFunction udfSetYear (strYmdHms, intYear) Return TimeAdd (ItemReplace ("0000", 1, strYmdHms, ":"), intYear : ":0:0:0:0:0") ; Make valid datetime string. ; This user defined function "udfSetYear" sets the YmdHms year part to the specified value. #EndFunction ;------------------------------------------------------------------------------------------------------------------------------------------ ;------------------------------------------------------------------------------------------------------------------------------------------ #DefineFunction udfSetMonth (strYmdHms, intMonth) Return TimeAdd (ItemReplace ("1", 2, strYmdHms, ":"), "0:" : intMonth - 1 : ":0:0:0:0") ; Make valid datetime string. ; This user defined function "udfSetMonth" sets the YmdHms month part to the specified value. #EndFunction ;------------------------------------------------------------------------------------------------------------------------------------------ ;------------------------------------------------------------------------------------------------------------------------------------------ #DefineFunction udfSetDay (strYmdHms, intDay) Return TimeAdd (ItemReplace ("1", 3, strYmdHms, ":"), "0:0:" : intDay - 1 : ":0:0:0") ; Make valid datetime string. ; This user defined function "udfSetDay" sets the YmdHms day part to the specified value. #EndFunction ;------------------------------------------------------------------------------------------------------------------------------------------ ;------------------------------------------------------------------------------------------------------------------------------------------ #DefineFunction udfSetHour (strYmdHms, intHour) Return TimeAdd (ItemReplace ("0", 4, strYmdHms, ":"), "0:0:0:" : intHour : ":0:0") ; Make valid datetime string. ; This user defined function "udfSetHour" sets the YmdHms hour part to the specified value. #EndFunction ;------------------------------------------------------------------------------------------------------------------------------------------ ;------------------------------------------------------------------------------------------------------------------------------------------ #DefineFunction udfSetMinute (strYmdHms, intMinute) Return TimeAdd (ItemReplace ("0", 5, strYmdHms, ":"), "0:0:0:0:" : intMinute : ":0") ; Make valid datetime string. ; This user defined function "udfSetMinute" sets the YmdHms minute part to the specified value. #EndFunction ;------------------------------------------------------------------------------------------------------------------------------------------ ;------------------------------------------------------------------------------------------------------------------------------------------ #DefineFunction udfSetSecond (strYmdHms, intSecond) Return TimeAdd (ItemReplace ("0", 6, strYmdHms, ":"), "0:0:0:0:0:" : intSecond) ; Make valid datetime string. ; This user defined function "udfSetSecond" sets the YmdHms second part to the specified value. #EndFunction ;------------------------------------------------------------------------------------------------------------------------------------------ ; Test. strYmdHms = TimeYmdHms () ; e. b. "2009:07:27:10:21:59". strYmdHms1 = udfSetYear (strYmdHms, 2010) ; e. g. "2010:07:27:10:21:59". strYmdHms2 = udfSetMonth (strYmdHms, 2) ; e. g. "2009:02:27:10:21:59". strYmdHms3 = udfSetDay (strYmdHms, 1) ; e. g. "2009:07:01:10:21:59". strYmdHms4 = udfSetHour (strYmdHms, 8) ; e. g. "2009:07:27:08:21:59". strYmdHms5 = udfSetMinute (strYmdHms, 5) ; e. g. "2009:07:27:10:05:59". strYmdHms6 = udfSetSecond (strYmdHms, 18) ; e. g. "2009:07:27:10:21:18". strYmdHms7 = udfSetSecond (strYmdHms, 180) ; e. g. "2009:07:27:10:24:00" = 21 + 3 minutes (180 seconds). Exit