GetDatetimeDifference (open)

Get difference between two datetimes

Syntax

LOADLIB "wh::datetime.whlib";

RECORD FUNCTION GetDatetimeDifference(DATETIME fromdate, DATETIME todate)

Parameters

DATETIME fromdate

Source date

DATETIME todate

Destination date (the 'later' date, if you want a positive result)

Return value

RECORD

A record explaining the difference. The days, msecs and totalmsecs cells will always have the same sign (ie, if days is positive, then msecs is positive). If one of the arguments is DEFAULT DATETIME the function will return DEFAULT RECORD.

INTEGER days

The total difference in days

INTEGER msecs

The remaining difference in milliseconds

INTEGER64 totalmsecs

The total difference in milliseconds

INTEGER years

The number of anniversaries between the dates

Description

This function returns the difference between two timestamps, split into days and milliseconds