DateDiff 関数を変換スクリプトで使用すると、予想よりも 1 日未満で出力が生成される。Summary<!-- /*NS Branding Styles*/ --> .ns-kb-css-body-editor-container { p { font-size: 12pt; font-family: Lato; color: #000000; } span { font-size: 12pt; font-family: Lato; color: #000000; } h2 { font-size: 24pt; font-family: Lato; color: black; } h3 { font-size: 18pt; font-family: Lato; color: black; } h4 { font-size: 14pt; font-family: Lato; color: black; } a { font-size: 12pt; font-family: Lato; color: #00718F; } a:hover { font-size: 12pt; color: #024F69; } a:target { font-size: 12pt; color: #032D42; } a:visited { font-size: 12pt; color: #00718f; } ul { font-size: 12pt; font-family: Lato; } li { font-size: 12pt; font-family: Lato; } img { display: ; max-width: ; width: ; height: ; } } レコード内の2つの日付フィールドの差を求めるAPIは複数あります。その1つであるDatediffとsubtract関数は、2つの日付/時刻フィールドの差を求めるために使用されます。 このKBでは、datediff関数が期待される出力よりも1日少ない結果を表示することで例外を生成するシナリオについて説明します。 Release<!-- /*NS Branding Styles*/ --> .ns-kb-css-body-editor-container { p { font-size: 12pt; font-family: Lato; color: #000000; } span { font-size: 12pt; font-family: Lato; color: #000000; } h2 { font-size: 24pt; font-family: Lato; color: black; } h3 { font-size: 18pt; font-family: Lato; color: black; } h4 { font-size: 14pt; font-family: Lato; color: black; } a { font-size: 12pt; font-family: Lato; color: #00718F; } a:hover { font-size: 12pt; color: #024F69; } a:target { font-size: 12pt; color: #032D42; } a:visited { font-size: 12pt; color: #00718f; } ul { font-size: 12pt; font-family: Lato; } li { font-size: 12pt; font-family: Lato; } img { display: ; max-width: ; width: ; height: ; } } Instructions<!-- /*NS Branding Styles*/ --> .ns-kb-css-body-editor-container { p { font-size: 12pt; font-family: Lato; color: #000000; } span { font-size: 12pt; font-family: Lato; color: #000000; } h2 { font-size: 24pt; font-family: Lato; color: black; } h3 { font-size: 18pt; font-family: Lato; color: black; } h4 { font-size: 14pt; font-family: Lato; color: black; } a { font-size: 12pt; font-family: Lato; color: #00718F; } a:hover { font-size: 12pt; color: #024F69; } a:target { font-size: 12pt; color: #032D42; } a:visited { font-size: 12pt; color: #00718f; } ul { font-size: 12pt; font-family: Lato; } li { font-size: 12pt; font-family: Lato; } img { display: ; max-width: ; width: ; height: ; } } このシナリオに基づくと、オブジェクトは変換スクリプトでこのように呼び出され、この問題が発生します。 OutputDays = (gs.dateDiff(source.u_trip_start_date,source.u_trip_end_date,false)).split(' ')[0]; この方法で datediff 関数を使用して、2 つの日付フィールド間の実際の差に従って結果を取得してみてください。2つの日付の違いを見つけるためのサンプルを次に示します。 var gdt1 = GlideDateTime('2021-02-25');var gdt2 = GlideDateTime('2021-04-01');var duration1 = gs.dateDiff(gdt1.getDisplayValue(), gdt2.getDisplayValue(), false);gs.print("diff " + duration1);