跳到主要内容

DATEVALUE

Converts a date in the form of text to a number that represents the date in the date-time code.

Syntax

expression.DATEVALUE(arg1);

expression - A variable that represents a ApiWorksheetFunction class.

Parameters

NameRequired/OptionalData typeDefaultDescription
arg1RequiredApiRange | ApiName | stringThe text that represents a date, between 1/1/1900 or 1/1/1904 (depending on the workbook's date system) and 12/31/9999.

Returns

number

Example

const worksheet = Api.GetActiveSheet();

let func = Api.GetWorksheetFunction();
let ans = func.DATEVALUE("2018-3-16");

worksheet.GetRange("C1").SetValue(ans);