// 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
*/
Pingback: Converter: ISO-Datetime-String to Workflow Datetime – Questetra Support