DateTimeUtils - グローバル
DateTimeUtils クラスは、日付/時刻関数のコレクションです。
DateTimeUtils クラスは、Script Include DateTimeUtils を使用して提供されます。
DateTimeUtils クラスは、任意のサーバー側スクリプトで使用でき、GlideAjax から利用できます。
DateTimeUtils - int8ToGlideDateTime(数値 int64)
Microsoft AD の整数 8 の DateTime 形式を GlideDateTime 形式に変換します。
Integer8はMicrosoft Filetime 形式とも呼ばれます。このメソッドは、AD ユーザーの日付フィールド(有効期限など)をインポートするときによく使用されます。
| 名前 | タイプ | 説明 |
|---|---|---|
| int64 | 番号 | 1601 年 1 月 1 日 (UTC)以降の 100 ナノ秒間隔の数を表す 64 ビット値 |
| タイプ | 説明 |
|---|---|
| GlideDateTime | GlideDateTime オブジェクトは、Integer8 の日付と時刻に設定されます。 |
//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(数値 milliseconds)
ミリ秒を GlideDateTime オブジェクトに変換します。
| 名前 | タイプ | 説明 |
|---|---|---|
| milliseconds | 番号 | ミリ秒数 |
| タイプ | 説明 |
|---|---|
| GlideDateTime | GlideDateTime object |
//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();