Hitachi

JP1 Version 11 JP1/Script Description and Reference (For Windows Systems)


8.4.13 CalcTime (add and subtract times)

Purpose

Adds or subtracts a specified number of hours, minutes, or seconds to or from a specified time, and returns the calculation result.

Syntax
CalcTime (Time, Calc, [Hours], [Minutes], [Seconds] [, DaysBuff])
Arguments
Time

Write the time in hh:mm:ss format.

If an invalid value is specified for hh, an error occurs. However, if an invalid value is specified for mm or ss, no error occurs. Instead, the CalcTime command replaces the specified time with the equivalent valid time.

For example, if 19:00:65 (a nonexistent time) were specified, the CalcTime command would replace the specified time with the valid time 19:01:05.

Calc

Specify the calculation to perform. Write either of the following values:

Value

Meaning

Minus

Subtraction: Return the time specified in Time, minus the hours, minutes, or seconds specified in Hours, Minutes, and/or Seconds.

Plus

Addition: Return the time specified in Time, plus the hours, minutes, or seconds specified in Hours, Minutes, and/or Seconds.

Hours

Write the hours as 0 or a number, or as a variable that stores this value.

This value is optional. If you omit this value, 0 is assumed.

Minutes

Write the minutes as 0 or a number, or as a variable that stores this value.

This value is optional. If you omit this value, 0 is assumed.

Seconds

Write the seconds as 0 or a number, or as a variable that stores this value.

This value is optional. If you omit this value, 0 is assumed.

DaysBuff

Specify a variable for storing the number of days when the calculated time falls on a different day. Omit this value if not required.

Zero is set in this variable if the result is within the same day.

Description

The CalcTime command adds or subtracts a specified number of hours, minutes, or seconds to or from a specified time, and returns the calculation result in hh:mm:ss format.

A zero-length string ("") is returned if an error occurs.

Example
' Queue a script file to execute automatically 7 hours
' and 45 minutes after the current time.
Dim resTime, resdate, daysBuff
resTime = CalcTime (Time(), Plus, 7, 45, , daysBuff)
resDate = CalcDate (Date(), Plus, , , daysBuff)
EntryStartUp (_SCF_+"ABC.SPT", , , resTime, , Day(resDate))
JP1/Script version

Supported from JP1/Script 05-20.