我有一列數據,其數值形式為 7 位或 8 位數字,我需要採用 HH、MM、SS 格式,但我嘗試過的所有方法都失敗了。我遺漏了什麼明顯的技巧嗎?
標記
其中一個數字是 61412。我相信這代表的是上午 6:14:12。
61412 有 5 位數字,而不是 7 位或 8 位。您很可能可以轉換您的數字?轉換為字串並使用帶有格式模式的 informat 將其轉換為 JMP 日期數字。
New Table( "Time",
Add Rows( 2 ),
New Column( "Time as Coded Number",
Numeric,
"Continuous",
Format( "Best", 12 ),
Set Values( [61412, 142954] )
),
New Column( "Time",
Numeric,
"Continuous",
Format( "h:m:s", 12, 0 ),
Input Format( "h:m:s", 0 ),
Formula(
t1 = If( :Time as Coded Number < 100000,
"0",
""
) || Char( :Time as Coded Number );
In Hours( Num( Left( t1, 2 ) ) )
+In Minutes( Num( Substr( t1, 3, 2 ) ) ) + Num( Right( t1, 2 ) );
)
)
)
您需要一個公式(或腳本)將原始的 5 位或 6 位數字(假設 24 小時制的 hh:mm:ss 編碼)轉換為秒數(JMP 的時間基準)並更改列格式。
這是格式模式選項,請注意,如果您的時間是 12 小時格式,則需要進行一些更改
InFormat(Right("0" || Char(:Column 1), 6), "Format Pattern", "
<HH>
<:?>
<MM>
<:?>
<SS>
")
</SS>
</MM>
</HH>
