--- title: Notification.timestamp slug: Web/API/Notification/timestamp tags: - API - Notification - Notifications - Notifications API - Property - Reference - timeStamp - プロパティ - 通知 translation_of: Web/API/Notification/timestamp ---
{{APIRef("Web Notifications")}}{{AvailableInWorkers}}{{securecontext_header}}
timestamp は {{domxref("Notification")}} インターフェイスの読取専用プロパティで、 {{domxref("Notification.Notification","Notification()")}} コンストラクターの timestamp オプションで指定された {{domxref("DOMTimeStamp")}} を返します。
通知のタイムスタンプは、 1970/01/01 00:00:00 UTC からの経過ミリ秒数で、通知が作成された時刻、または通知に関連づけたい任意のタイムスタンプを表します。例えば、予定されている会議のタイムスタンプは未来に設定することができ、一方、見逃したメッセージのタイムスタンプは過去に設定することができます。
var timestamp = Notification.timestamp;
{{domxref("DOMTimeStamp")}} です。
次のスニペットは通知を発行します。単純な options オブジェクトが生成され、通知が Notification() コンストラクターを使用して発行されます。
var dts = Math.floor(Date.now());
var options = {
body: 'Do you like my body?',
timestamp: dts
}
var n = new Notification('Test notification',options);
console.log(n.timestamp) // should log original timestamp
| 仕様書 | 状態 | 備考 |
|---|---|---|
| {{SpecName('Web Notifications','#dom-notification-timestamp','timestamp')}} | {{Spec2('Web Notifications')}} | Living standard |
{{Compat("api.Notification.timestamp")}}