0

パッケージ内の要素を実行する jscript を作成したので、element.created と今日の比較を追加する必要があります。どうすればこれを作ることができますか?

4

1 に答える 1

0

次のコードを参照して、それに応じて変更してください

// get the date from the element
var dateCreated = new Date(theElement.Created);

// remove the hours, minutes, seconds, miliseconds
dateCreated.setHours(0,0,0,0);

// create the date object to compare
// input parameter is yyyy, mm, dd
// please note that the mm starts from 0 for January
var dateToCompare = new Date(2013, 0, 13);

// sample usage
if (dateCreated > dateToCompare)
{
    Session.Output("Creation date is newer");
}
else if (dateCreated < dateToCompare)
{
    Session.Output("Creation date is older");
}
else
{
    Session.Output("Creation date match");
}
于 2013-08-13T03:53:43.777 に答える