DateTimeUtils - グローバル

  • リリースバージョン: Yokohama
  • 更新日 2025年01月30日
  • 所要時間:2分
  • DateTimeUtils スクリプトインクルードは、日付/時刻関数のコレクションです。

    このスクリプトインクルードは、任意のサーバーサイドスクリプトで使用でき、GlideAjax を介して利用できます。

    DateTimeUtils - int8ToGlideDateTime(数値 int64)

    Microsoft AD の整数 8 の DateTime 形式を GlideDateTime 形式に変換します。

    Integer8はMicrosoft Filetime 形式とも呼ばれます。このメソッドは、AD ユーザーの日付フィールド(有効期限など)をインポートするときによく使用されます。

    表 : 1. パラメーター
    名前 タイプ 説明
    int64 番号 1601 年 1 月 1 日 (UTC)以降の 100 ナノ秒間隔の数を表す 64 ビット値
    表 : 2. 返される内容
    タイプ 説明
    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 オブジェクトに変換します。

    表 : 3. パラメーター
    名前 タイプ 説明
    milliseconds 番号 ミリ秒数
    表 : 4. 返される内容
    タイプ 説明
    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();