GetTime
Returns the timestamp of the current form.
Syntax
expression.GetTime();
expression - A variable that represents a ApiDateForm class.
Parameters
This method doesn't have any parameters.
Returns
undefined | number
Example
Read the timestamp stored in a date form in a document.
// How do I get the date and time value entered into a date form in a document?
// Convert the returned timestamp to a readable date to display it as a formatted string.
let doc = Api.GetDocument();
let dateForm = Api.CreateDateForm({"key": "Nowadays", "tip": "Enter current date", "required": true, "placeholder": "Your date here", "format": "mm.dd.yyyy", "lang": "en-US"});
let paragraph = doc.GetElement(0);
paragraph.AddElement(dateForm);
dateForm.SetTime(new Date().getTime());
let timeStamp = dateForm.GetTime();
paragraph = Api.CreateParagraph();
paragraph.AddText("The first date form from this document has setted time: " + new Date(timeStamp));
doc.Push(paragraph);