JavaScript(JS) 透過 substr函數 進行 字串切割/分割/分段 (子字串)運算
JavaScript(JS) 透過 substr函數 進行 字串切割/分割/分段 (子字串)運算
線上執行(線上編譯): https://www.programiz.com/javascript/online-compiler/
code:
// Online Javascript Editor for free // Write, Edit and Run your Javascript code using JS Online Compiler Trans_Date= "230504"; Trans_Time= "101907"; console.log("20"+Trans_Date.substr(0, 2)+"/"+Trans_Date.substr(2, 2)+"/"+Trans_Date.substr(4, 2)+" " +Trans_Time.substr(0, 2)+":"+Trans_Time.substr(2, 2)); console.log("Welcome to Programiz!"); /* node /tmp/r5Iostsc6w.js 2023/05/04 10:19 Welcome to Programiz! */