Skip to main content

SetDateFormat

Sets the date format for the datepicker content control. This method allows setting the format in which the date should be displayed in the datepicker content control. The format string should be specified using common date format patterns (e.g., "mm.dd.yyyy").

Syntax

expression.SetDateFormat(dateFormat);

expression - A variable that represents a ApiInlineLvlSdt class.

Parameters

NameRequired/OptionalData typeDefaultDescription
dateFormatRequiredstringThe desired date format (e.g., "mm.dd.yyyy").

Returns

boolean

Example

Set a custom date format for a datepicker content control in a document.

// How to set date format for an inline content control?

// Set date format and display the result in a document.

let doc = Api.GetDocument();
let contentControl = doc.AddDatePickerContentControl();
let paragraph1 = Api.CreateParagraph();
contentControl.SetDateFormat('dd.mm.yyyy');
contentControl.SetDate(new Date(1998, 2, 1));