CDF_EPOCH_COMPARE

Syntax | Return Value | Arguments | Keywords | Examples | Version History

The CDF_EPOCH_COMPARE function compares two epoch (date and time) values.

Syntax

Result = CDF_EPOCH_COMPARE(epoch1, epoch2)

Return Value

Returns 1 if the value of the first epoch is greater (a later date and time) than the second epoch. Returns 0 if the value of the first epoch is the same as the second epoch. Returns -1 if the value of the first epoch is less (earlier date and time) than the second epoch.

1

if epoch1 > epoch2

0

if epoch1 = epoch2

-1

if epoch1 < epoch2

Arguments

epoch1

epoch2

An epoch value returned from CDF_EPOCH or CDF_EPOCH16 with the COMPUTE keyword set, or from CDF_VARGET or CDF_VARGET1.

Keywords

None

Examples

CDF_EPOCH, epoch, 2005,6,1,10,18,17,2,/COMPUTE 
CDF_EPOCH, epoch1, 2005,6,1,10,18,17,2,3,4,5,/COMPUTE 
IF CDF_EPOCH_COMPARE(epoch,epoch1) EQ 0 THEN $ 
   PRINT, "epoch = epoch1" $ 
ELSE IF (CDF_EPOCH_COMPARE(epoch,epoch1) EQ 1) THEN $ 
   PRINT, "epoch > epoch1 - epoch is a later date than epoch1" $ 
ELSE $    ; return value is -1 
   PRINT, "epoch < epoch1 - epoch1 is a later date than epoch" 

Version History

6.4

Introduced