コンバータ: タイムスタンプ to 日時

コンバータ: タイムスタンプ to 日時
コンバータ: タイムスタンプ to 日時 (Converter: Timestamp-Number to Datetime)
タイムスタンプ値(UNIXタイム)を日時型データに変換します。すなわち、協定世界時 1970-01-01 00:00:00 からの経過秒数(2002年以降は10桁整数)から、時刻型データを算出します。ワークフロー基盤のタイムゾーンに従います。
Configs
  • A: Timestamp数値をセットしてください (例 “1234567890”) *#{EL}
  • B: 変換された日時が格納される日時型データ項目を選択してください (更新) *
Script (click to open)
// GraalJS Script (engine type: 2)

//////// START "main()" /////////////////////////////////////////////////////////////////
main();
function main(){ 

//// == Config Retrieving / 工程コンフィグの参照 ==
const strTimestamp       = configs.get( "StrConfA" ); // required
  if( strTimestamp     === "" ){
    throw new Error( "\n AutomatedTask ConfigError:" +
                     " Config {A: Timestamp} is empty \n" );
  }
  let numTimestamp       = parseInt( strTimestamp, 10 );
const dtPocketOutput     = configs.getObject( "SelectConfB" );
engine.log( " AutomatedTask: Workflow Platform offset: " +
            (engine.getTimeZoneOffsetInMinutes() /60) );


//// == Data Retrieving / ワークフローデータの参照 ==
// (Nothing. Retrieved via Expression Language in Config Retrieving)


//// == Calculating / 演算 ==
//let dateUniversal  = new Date( numTimestamp * 1000 );
let numMsecUniversal = numTimestamp * 1000;


//// == Data Updating / ワークフローデータへの代入 ==
engine.setData( dtPocketOutput,      new java.sql.Timestamp( numMsecUniversal ) );


} //////// END "main()" /////////////////////////////////////////////////////////////////



/*
Notes:
- Unix time acquired by API communication or Webhook reception can be converted to Datetime data.
    - Seconds less than a minute are truncated. (YYYY-MM-DD hh:mm)
    - The limit of Datetime type data in the Workflow Platform is "1900 to 2100".
    - https://support.questetra.com/data-items/datetime-type/
- Unix time is the number of seconds that have elapsed since the Unix epoch, minus leap seconds.
    - The Unix epoch is 00:00:00 UTC on 1 January 1970 (an arbitrary date).
    - Unix time is also known as Epoch time, POSIX time, seconds since the Epoch, or UNIX Epoch time.
    - ECMAScript epoch time ("milliseconds") is 1000 times the value of Unix time ("seconds").

Notes-ja:
- API通信やWebhook受信等で取得されたUnix時間(タイムスタンプ)を時刻型データに変換できます。
    - 分以下の秒数は切り捨てられます。 (YYYY-MM-DD hh:mm)
    - ワークフロー基盤における時刻型データの制限は「1900年から2100年まで」です。
    - https://support.questetra.com/ja/data-items/datetime-type/
- Unix時間は「Unixエポック」からの経過秒数です。(うるう秒の存在は排除されます)
    - Unixエポックは、協定世界時(UTC)の1970年1月1日00:00:00を指します。(意味のある日ではない)
    - Unix時間は、Unixタイム、エポックタイム、POSIXタイム、Unixエポックタイムなどとも呼ばれます。
    - ECMAScript epoch time("経過ミリ秒数")は、Unix time("経過秒数")の1000倍の値になります。
*/


/*
APPENDIX
- Wikipedia: Unix Time, UTC
    - https://en.wikipedia.org/wiki/Unix_time
    - https://en.wikipedia.org/wiki/Coordinated_Universal_Time
- Note, the "Serial Number" in Spreadsheet or Excel is the number of days since 1899-12-30 00:00.
    - https://developers.google.com/sheets/api/reference/rest/v4/DateTimeRenderOption

APPENDIX-ja
- Wikipedia: Unix Time, UTC
    - https://ja.wikipedia.org/wiki/UNIX%E6%99%82%E9%96%93
    - https://ja.wikipedia.org/wiki/%E5%8D%94%E5%AE%9A%E4%B8%96%E7%95%8C%E6%99%82
- なお、Spreadsheet や Excel における "Serial Number" は、1899-12-30 00:00 からの経過日数です。
    - https://developers.google.com/sheets/api/reference/rest/v4/DateTimeRenderOption
*/


Download

2021-03-01 (C) Questetra, Inc. (MIT License)
https://support.questetra.com/ja/addons/converter-datetimes-in-difference-timezones/
Addonファイルのインポートは Professional でのみご利用いただけます

Notes

  • API通信やWebhook受信等で取得されたUnix時間(タイムスタンプ)を時刻型データに変換できます。
  • Unix時間は「Unixエポック」からの経過秒数です。(うるう秒の存在は排除されます)
    • Unixエポックは、協定世界時(UTC)の1970年1月1日00:00:00を指します。(意味のある日ではない)
    • Unix時間は、Unixタイム、エポックタイム、POSIXタイム、Unixエポックタイムなどとも呼ばれます。
    • ECMAScript epoch time(”経過ミリ秒数”)は、Unix time(”経過秒数”)の1000倍の値になります。

Capture

タイムスタンプ値(UNIXタイム)を日時型データに変換します。すなわち、協定世界時 1970-01-01 00:00:00 からの経過秒数(2002年以降は10桁整数)から、時刻型データを算出します。ワークフロー基盤のタイムゾーンに従います。

Appendix

See also

コンバータ: ISO日時文字列 to ワークフロー日時

コメントを残す

このサイトはスパムを低減するために Akismet を使っています。コメントデータの処理方法の詳細はこちらをご覧ください

Questetra Supportをもっと見る

今すぐ購読し、続きを読んで、すべてのアーカイブにアクセスしましょう。

続きを読む

上部へスクロール