Hitachi

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


8.4.14 CompTime (compare times)

Purpose

Compares two specified times and returns True or False.

Syntax
CompTime (Time1, Comp, Time2)
Arguments
Time1

Write one of the times to be compared 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 CompTime command replaces the specified time with the equivalent valid time.

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

Comp

Specify how to compare the times. Write one of the following values:

Value

Meaning

Equal

Equal (=)

NotEqual

Not equal (<>)

Before

Time2 comes before Time1 (>)

After

Time2 comes after Time1 (<)

Time2

Write the other time in hh:mm:ss format.

If an invalid value is specified for mm or ss, the CompTime command replaces the specified time with the equivalent valid time.

Description

The CompTime command compares two times using the method specified in Comp, and returns True or False as the command execution result.

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

Example
' Delete files created this morning.
Dim fileName, creDate, creTime
 
For fileName = _TEMP_+"*.*" Do
  GetFileTime (_TEMP_+fileName, creDate, creTime, Create)
  If CompDate (creDate, Equal, Date()) Then
    If CompTime (creTime, After, "12:00:00") = True Then
      DeleteFile (_TEMP_+fileName)
    End If
  End If
End For
JP1/Script version

Supported from JP1/Script 05-20.