---
sourceDocument: Xanadu API リファレンス
sourceDocumentLink: https://servicenow-prod.fluidtopics.net/r/ja-JP/xanadu/api-reference

 Release :

    - xanadu

ft:locale :

    - ja-JP

ft:publication_title :

    - Xanadu API リファレンス

ft:clusterId :

    - crapiref

bundleId :

    - crapiref

workflow :

    - Creator


---

# DateTimeUtils - グローバル

# DateTimeUtils - グローバル {#ariaid-title1}

* リリースバージョン: Xanadu
* 
* 更新日 2024年08月01日
* 
* ![](https://www.servicenow.com/docs/portal-asset/ico-clock) 所要時間：2分

DateTimeUtils スクリプトインクルードは、日付/時刻関数のコレクションです。

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

## DateTimeUtils - int8ToGlideDateTime(数値 int64) {#ariaid-title2}

Microsoft AD の整数 8 の DateTime 形式を GlideDateTime 形式に変換します。
Integer8はMicrosoft Filetime 形式とも呼ばれます。このメソッドは、AD ユーザーの日付フィールド(有効期限など)をインポートするときによく使用されます。
{#r_DTU-int8ToGlideDateTime_N__table_rzj_nn1_4t__entry__3}

| 名前 | タイプ | 説明 |
|-|-|-|
| int64 | 番号 | 1601 年 1 月 1 日 (UTC)以降の 100 ナノ秒間隔の数を表す 64 ビット値 |
[表 : 1. パラメーター]

{#r_DTU-int8ToGlideDateTime_N__table_rzj_nn1_4t} {#r_DTU-int8ToGlideDateTime_N__table_szj_nn1_4t__entry__2}

| タイプ | 説明 |
|-|-|
| GlideDateTime | GlideDateTime オブジェクトは、Integer8 の日付と時刻に設定されます。 |
[表 : 2. 返される内容]

{#r_DTU-int8ToGlideDateTime_N__table_szj_nn1_4t}  

    //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) {#ariaid-title3}

ミリ秒を GlideDateTime オブジェクトに変換します。
{#r_DTU-msToGlideDateTime_N__table_ocn_p41_4t__entry__3}

| 名前 | タイプ | 説明 |
|-|-|-|
| milliseconds | 番号 | ミリ秒数 |
[表 : 3. パラメーター]

{#r_DTU-msToGlideDateTime_N__table_ocn_p41_4t} {#r_DTU-msToGlideDateTime_N__table_pcn_p41_4t__entry__2}

| タイプ | 説明 |
|-|-|
| GlideDateTime | GlideDateTime object |
[表 : 4. 返される内容]

{#r_DTU-msToGlideDateTime_N__table_pcn_p41_4t}  

    //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();


