DateTimeUtils - グローバル
DateTimeUtils スクリプトインクルードは、日付/時刻関数のコレクションです。
このスクリプトインクルードは任意のサーバーサイドスクリプトで使用でき、GlideAjax から利用できます。
DateTimeUtils:int8ToGlideDateTime(数値 int64)
Microsoft AD integer8 DateTime 形式を GlideDateTime 形式に変換します。
Integer8 は、Microsoft ファイルタイム形式とも呼ばれます。この方法は、有効期限などの AD ユーザーの日付フィールドをインポートするときによく使用されます。
| 名前 | タイプ | 説明 |
|---|---|---|
| int64 | 番号 | 1601 年 1 月 1 日 (UTC) からの 100 ナノ秒間隔の数を表す 64 ビットの値。 |
| タイプ | 説明 |
|---|---|
| GlideDateTime | Integer8 の日時に設定された GlideDateTime オブジェクト。 |
//convert and set account expiration date from AD
//this is an example that could be used in an LDAP import transform map to import the LDAP account
//expires attribute to a customer created u_account_expires GlideDateTime field
var dtUtil = new DateTimeUtils();
target.u_account_expires = dtUtil.int8ToGlideDateTime(source.u_accountexpires);
DateTimeUtils - msToGlideDateTime(ミリ秒数)
ミリ秒を GlideDateTime オブジェクトに変換する
| 名前 | タイプ | 説明 |
|---|---|---|
| ミリ秒 | 番号 | ミリ秒数 |
| タイプ | 説明 |
|---|---|
| GlideDateTime | GlideDateTime オブジェクト |
//example script to call the method from a client
Replace MILLISECONDSVALUE with your variable
var ga = new GlideAjax('DateTimeUtils');
ga.addParam('sysparm_name','msToGlideDateTime');
ga.addParam('sysparm_value', MILLISECONDSVALUE);
ga.getXMLWait();
var newGDT = ga.getAnswer();