博途V16 获取系统时间转换成字符串
生活随笔
收集整理的這篇文章主要介紹了
博途V16 获取系统时间转换成字符串
小編覺(jué)得挺不錯(cuò)的,現(xiàn)在分享給大家,幫大家做個(gè)參考.
//獲取系統(tǒng)時(shí)間
#nSystemTime := RD_SYS_T(#stSystemTime);//轉(zhuǎn)換成字符串
#sYear := '';
VAL_STRG(IN := #stSystemTime.YEAR,SIZE := 4,PREC := 0,FORMAT := 0,P := 1,OUT => #sYear);#sMonth := '';
IF #stSystemTime.MONTH < 10 THENVAL_STRG(IN := #stSystemTime.MONTH,SIZE := 1,PREC := 0,FORMAT := 0,P := 1,OUT => #sMonth);#sMonth := CONCAT(IN1 := '0', IN2 := #sMonth);
ELSEVAL_STRG(IN := #stSystemTime.MONTH,SIZE := 2,PREC := 0,FORMAT := 0,P := 1,OUT => #sMonth);
END_IF;#sDay := '';
IF #stSystemTime.DAY < 10 THENVAL_STRG(IN := #stSystemTime.DAY,SIZE := 1,PREC := 0,FORMAT := 0,P := 1,OUT => #sDay);#sDay := CONCAT(IN1 := '0', IN2 := #sDay);
ELSE VAL_STRG(IN := #stSystemTime.DAY,SIZE := 2,PREC := 0,FORMAT := 0,P := 1,OUT => #sDay);
END_IF;#sHour := '';
IF #stSystemTime.HOUR < 10 THENVAL_STRG(IN := #stSystemTime.HOUR,SIZE := 1,PREC := 0,FORMAT := 0,P := 1,OUT => #sHour);#sHour := CONCAT(IN1 := '0', IN2 := #sHour);
ELSEVAL_STRG(IN := #stSystemTime.HOUR,SIZE := 2,PREC := 0,FORMAT := 0,P := 1,OUT => #sHour);
END_IF;#sMinute := '';
IF #stSystemTime.MINUTE < 10 THENVAL_STRG(IN := #stSystemTime.MINUTE,SIZE := 1,PREC := 0,FORMAT := 0,P := 1,OUT => #sMinute);#sMinute := CONCAT(IN1 := '0', IN2 := #sMinute);
ELSEVAL_STRG(IN := #stSystemTime.MINUTE,SIZE := 2,PREC := 0,FORMAT := 0,P := 1,OUT => #sMinute);
END_IF;#sSecond := '';
IF #stSystemTime.SECOND < 10 THENVAL_STRG(IN := #stSystemTime.SECOND,SIZE := 1,PREC := 0,FORMAT := 0,P := 1,OUT => #sSecond);#sSecond := CONCAT(IN1 := '0', IN2 := #sSecond);
ELSE VAL_STRG(IN := #stSystemTime.SECOND,SIZE := 2,PREC := 0,FORMAT := 0,P := 1,OUT => #sSecond);
END_IF;#sSystemTime := CONCAT(IN1 := #sYear, IN2 := '-');
#sSystemTime := CONCAT(IN1 := #sSystemTime, IN2 := #sMonth);
#sSystemTime := CONCAT(IN1 := #sSystemTime, IN2 := '-');
#sSystemTime := CONCAT(IN1 := #sSystemTime, IN2 := #sDay);
#sSystemTime := CONCAT(IN1 := #sSystemTime, IN2 := '-');
#sSystemTime := CONCAT(IN1 := #sSystemTime, IN2 := #sHour);
#sSystemTime := CONCAT(IN1 := #sSystemTime, IN2 := ':');
#sSystemTime := CONCAT(IN1 := #sSystemTime, IN2 := #sMinute);
#sSystemTime := CONCAT(IN1 := #sSystemTime, IN2 := ':');
#sSystemTime := CONCAT(IN1 := #sSystemTime, IN2 := #sSecond);
總結(jié)
以上是生活随笔為你收集整理的博途V16 获取系统时间转换成字符串的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問(wèn)題。
- 上一篇: 厦门大学考研真题笔记:334新闻与传播专
- 下一篇: 2017无盘服务器主板,2017版云更新