跳到主要内容

GetTime

Returns the timestamp of the comment creation in the current time zone format.

Syntax

expression.GetTime();

expression - A variable that represents a ApiComment class.

Parameters

This method doesn't have any parameters.

Returns

Number

Example

This example shows how to get the timestamp of the comment creation in the current time zone format.

// How to know when a comment was added.

// Get all comments from the presentation and the first one's time of creation.

let doc = Api.GetDocument();
let paragraph = doc.GetElement(0);
paragraph.AddText("This is just a sample text");
Api.AddComment(paragraph, "comment", "John Smith");
let comments = doc.GetAllComments();
comments[0].SetTime("1672247153658");
let time = comments[0].GetTime();
paragraph = Api.CreateParagraph();
paragraph.AddText("Comment creation timestamp: " + time);
doc.Push(paragraph);