列の式でUTCタイムスタンプをローカル時間に変換する方法
こんにちは、みんな、
I have a column Timestamp UTC in JMP with values like 2025-10-31T08:30:00.
I want to create a new column Timestamp Local that converts this UTC time to local time
Is there a simple formula-based way to add 5.5 hours to my timestamp directly in a 列の式, without scripting or using Date Add?
次のようなものです:
Informat(:Timestamp UTC, "yyyy-mm-ddThh:mm:ss") + (4 * 3600)
しかし、結果や数式の評価エラーが発生しないため、これが正しい構文であるかどうかはわかりません。
ディスカッションスレッドに基づいて試してみました:
<'T'>
<HH24>
<::>
<MM>
<::>
<SS>
Z") + (4 * 3600)
</SS>
</MM>
</HH24>
- 結果なし
式は次のようになります。
Also tried Format - "yyyy-mm-ddThh:mm:ss"
col_name_list = Current Data Table() << get column names( string );
If(
!Contains(col_name_list, "Timestamp Local"),
Current Data Table() << New Column(
"Timestamp Local",
Numeric,
Continuous,
Format("m/d/y h:m:s"),
Formula(
Informat(:Name("Timestamp UTC"),
//"Format Pattern",
"yyyy-mm-ddThh:mm:ss") + (4* 3600)
)
)
);
Informat(:Timestamp UTC, "Format Pattern", "
<YYYY>
<->
<MM>
<->
</MM>
</YYYY>
列の式内で UTC からローカルへの変換を適切に処理する方法に関するガイダンスや例があれば幸いです。
ありがとう!
自動化とスクリプト基本的なデータ分析とモデリングデータのブレンドとクリーンアップRe: 列の式でUTCタイムスタンプをローカル時間に変換する方法これはオプションですか?
![TimeAdd_2025-11-03 13_22_07-Time Plus - JMP [2].png TimeAdd_2025-11-03 13_22_07-Time Plus - JMP [2].png](https://us.v-cdn.net/6038925/uploads/images/86259i38E814A6E03787A1/TimeAdd_2025-11-03%2013_22_07-Time%20Plus%20-%20JMP%20%5B2%5D.png)
</CODE></PRE>
<P> </P>
<PRE><CODE class=" language-jsl">New Column( "Time Plus",
Numeric,
"Continuous",
Format( "yyyy-mm-ddThh:mm:ss", 19, 0 ),
Input Format( "yyyy-mm-ddThh:mm:ss", 0 ),
Formula( :Timestamp + In Hours( 5.5 ) ),
Set Selected
)
Re: 列の式でUTCタイムスタンプをローカル時間に変換する方法New Table( "Untitled",
Add Rows( 2 ),
New Column( "old", Character, "Nominal", Set Values( {"2025-10-31T08:30:00", "2025-10-31T08:30:01"} ), Set Display Width( 153 ) ),
New Column( "new",
Numeric,
"Continuous",
Format( "Monddyyyy h:m:s", 22, 0 ),
Input Format( "Monddyyyy h:m:s", 0 ),
Formula( Informat( :old, "yyyy-mm-ddThh:mm:ss" ) + In Hours( 5.5 ) )
)
)

JMPは日付時刻値を1904年からの経過秒数として保存します。InHours関数は引数の3600倍を返します。Timestamp列(私の例では古いもの)には文字データが入っていると想定しています。
Re: 列の式でUTCタイムスタンプをローカル時間に変換する方法参考のためにこれを追加すべきでした。
これは生データからのモデリングttype - 連続
フォーマットは次のように定義されます:
Format("m/d/y h:m:s")
Re: 列の式でUTCタイムスタンプをローカル時間に変換する方法参考のためにこれを追加すべきでした。
これは生データからのモデリングttype - 連続
フォーマットは次のように定義されます:
Format("m/d/y h:m:s")<BR /><BR />I tried the formula above, it didn't yeild any output. I will check again.
Re: 列の式でUTCタイムスタンプをローカル時間に変換する方法@mlo1 @Craige_Hales
これはうまくいきました。
col_name_list = Current Data Table() << get column names( string );
If( !Contains( col_name_list, "Timestamp Local" ), //If the column name doesn't exist in the array col_name_list
Current Data Table() << New Column(
"Timestamp Local",
Numeric,
"Continuous",
Format( "m/d/y h:m:s", 22, 0),
//Input Format( "Monddyyyy h:m:s", 0 ),
Formula(
//In Format( :Timestamp UTC, "yyyy-mm-ddThh:mm:ss" ) + In Hours( 5.5 )
Informat( Substitute(:Timestamp UTC, "+00:00", ""), "yyyy-mm-dd hh:mm:ss" ) + In Hours(5.5)
),
//Formula( :Timestamp + In Hours( 5.5 ) ),
//Set Selected
)
);<BR /><BR />
| UTC時間 |
現地時間 |
| 2025-09-14 07:51:52+00:00 |
2025年9月14日 午後1時21分52秒 |
| 2025-09-14 07:56:52+00:00 |
2025年9月14日午後1時26分52秒 |
Re: 列の式でUTCタイムスタンプをローカル時間に変換する方法しかし、この公式は機能しない
If(!Contains(col_name_list, "Max Timestamp UTC"),
Current Data Table() << New Column(
"Max Timestamp UTC",
Numeric,
Continuous,
Format("m/d/y h:m:s", 22, 0),
Formula(
Col Maximum(
:Name("Timestamp UTC"),
/*Informat(
Substitute(:Name("Timestamp UTC"), "+00:00", ""),
"yyyy-mm-dd hh:mm:ss"
),*/
:Name("ID")
)
)
)
);
現状のままのバージョンでは、コードのコメント部分は時間がかかるようで、無限ループに入り、JMP が応答しなくなり、アプリケーションを強制終了しなければなりません。
以前にもこれを実行しましたが、以下のコードを使用せずにローカルタイムスタンプが生成されました。
:Name("Timestamp UTC") << Data Type(Character) << Modeling Type(Nominal);
Re: 列の式でUTCタイムスタンプをローカル時間に変換する方法どのバージョンのJMPをお使いですか?Col Maxの速度に問題がある場合は、まず別の列を作成して
Informat(Substitute(:"Timestamp UTC"n, "+00:00", ""), "yyyy-mm-dd hh:mm:ss")
そして、新しく作成された列を変数として使用します。
Re: 列の式でUTCタイムスタンプをローカル時間に変換する方法はい、試してみました
dt:Name( "Timestamp UTC" ) << Informat(
Substitute( :Timestamp UTC, "+00:00", "" ),
"yyyy-mm-dd hh:mm:ss"
);
dt:Name( "Timestamp UTC" ) << Data Type( Character ) << Modeling Type( Nominal );
col_name_list = Current Data Table() << get column names ( string );
If( !Contains(col_name_list, "Timestamp UTC (Numeric)"),
Current Data Table() << New Column(
"Timestamp UTC (Numeric)",
Numeric,
"Continuous",
Format("m/d/y h:m:s", 22, 0),
Formula(
Informat( Substitute(:Timestamp UTC, "+00:00", ""), "yyyy-mm-dd hh:mm:ss" )
)
)
);
dt:Name("Timestamp UTC (Numeric)") << Delete Formula;
dt:Name("Timestamp UTC") <<
Set Values(:Name("Timestamp UTC (Numeric)")) <<
Data Type(Numeric) <<
Format("m/d/y h:m:s", 22, 0);
これを試しています。タイムスタンプUTC列が上書きされ、値がありません。
Re: 列の式でUTCタイムスタンプをローカル時間に変換する方法使用しているテーブルの例を教えていただけますか?タイムスタンプ列だけで十分です(テーブル変数/スクリプトも削除することを忘れないでください)。
Re: 列の式でUTCタイムスタンプをローカル時間に変換する方法@jthiこの解決策を参考にしてください。追加の列を作成してそれを使うと、手間がかかりません。