在LabVIEW中將Date/Time字串轉換為Timestamp常數

更新 Nov 8, 2020

環境

軟體

  • LabVIEW

我在LabVIEW中有一個Date/Time字串,我想將他轉換為LabVIEW Timestamp 資料類型。我該怎麼做呢?

要將Date/Time字串轉換為Timestamp 常數,主要有兩個方式可選擇:

使用Scan from String VI:
  1. 在block diagram上放置一個Scan from String VI。
  2. 右鍵點選 Scan from String VI,然後從下拉選單中選擇 Edit Scan String
  3. Selected operation 選單中選擇掃Scan time stamp
  4. 使用Corresponding scan string textbox自定義string format。您可以使用Time Stamp格式代碼檢查string format。注意:如果您將string format保留為%T ,LabVIEW將根據常用格式進行猜測。使用此方法的範例如下圖所示:

使用 Time Stamp Control 或 Indicator  NumText.Text property:
  1. 創建一個 Timestamp control 或 indicator。
  2. 為 control或 indicator創建 property node,然後選擇 NumText.Text屬性。
  3. 右鍵點選 property node,然後選擇Change All to Write 。
  4. 右鍵點選 Timestamp control 或 indicator,然後選擇Properties
  5. 切換到Display Format tab以自定義字串格式,如下圖所示。

以下是使用此方法的範例: