Hitachi

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


8.4.11 CompDate (compare dates)

Purpose

Compares two specified dates and returns True or False.

Syntax
CompDate (Date1, Comp, Date2)
Arguments
Date1

Write one of the dates to be compared in yyyy/mm/dd format. Numbers specified in the range 0 to 69 in yyyy are read as 2000 to 2069.

If an invalid value is specified for mm, an error occurs. However, if an invalid value is specified for dd, no error occurs. Instead, the CompDate command replaces the specified date with the equivalent valid date and returns the result.

For example, if 1999/12/33 (a nonexistent date) were specified, the CompDate command would replace the specified date with the valid date 2000/01/02.

Comp

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

Value

Meaning

Equal

Equal (=)

NotEqual

Not equal (<>)

Before

Date2 comes before Date1 (>)

After

Date2 comes after Date1 (<)

Date2

Write the other date in yyyy/mm/dd format. Numbers specified in the range 0 to 69 in yyyy are read as 2000 to 2069. If an invalid value is specified for mm, an error occurs. However, if an invalid value is specified for dd, the CompDate command replaces the specified date with the equivalent valid date.

Description

The CompDate command compares two dates 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 the files in the temporary folder that
' were created 30 or more days ago.
Dim fileName, delDate, creDate
delDate = CalcDate (Date(), Minus, 0, 0, 29)
 
For fileName = _TEMP_+"*.*" Do
  GetFileTime (_TEMP_+fileName, creDate, , Create)
  If CompDate (creDate, After, deldate) = True Then
    DeleteFile (_TEMP_+fileName)
  End If
End For
JP1/Script version

Supported from JP1/Script 05-20.