Table of Contents

TUserDefinedFunction.TryGetDate Method

Tries to retrieve a date/time from a parameter, and return it if it can be converted or an error if not.

Syntax

Unit: FlexCel.Core

class function TUserDefinedFunction.TryGetDate(const xls: TExcelFile; const param: TFormulaValue; const SuppressTime: Boolean; out ResultValue: TDateTime; out ResultError: TFlxFormulaErrorValue): Boolean; static;

Parameters

<-> Parameter Type Description
const xls TExcelFile ExcelFile used to read the parameter when it is a cell reference.
const param TFormulaValue One of the parameters passed to Evaluate
const SuppressTime Boolean If true, the date returned will have the time set to 0:00 no matter the real value.
out ResultValue TDateTime Value of the parameter as double. If TryGetDate returns false, this value is undefined.
out ResultError TFlxFormulaError​Value Value of the error when converting the parameter. If TryGetDate returns true (there was no error), this value is undefined.

Returns

True if the parameter can be converted to a datetime, false if there was an error.

See also