当前位置:网站首页>博途V16 获取系统时间转换成字符串
博途V16 获取系统时间转换成字符串
2022-07-01 18:45:00 【WX_LW】
//获取系统时间
#nSystemTime := RD_SYS_T(#stSystemTime);
//转换成字符串
#sYear := '';
VAL_STRG(IN := #stSystemTime.YEAR,
SIZE := 4,
PREC := 0,
FORMAT := 0,
P := 1,
OUT => #sYear);
#sMonth := '';
IF #stSystemTime.MONTH < 10 THEN
VAL_STRG(IN := #stSystemTime.MONTH,
SIZE := 1,
PREC := 0,
FORMAT := 0,
P := 1,
OUT => #sMonth);
#sMonth := CONCAT(IN1 := '0', IN2 := #sMonth);
ELSE
VAL_STRG(IN := #stSystemTime.MONTH,
SIZE := 2,
PREC := 0,
FORMAT := 0,
P := 1,
OUT => #sMonth);
END_IF;
#sDay := '';
IF #stSystemTime.DAY < 10 THEN
VAL_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 THEN
VAL_STRG(IN := #stSystemTime.HOUR,
SIZE := 1,
PREC := 0,
FORMAT := 0,
P := 1,
OUT => #sHour);
#sHour := CONCAT(IN1 := '0', IN2 := #sHour);
ELSE
VAL_STRG(IN := #stSystemTime.HOUR,
SIZE := 2,
PREC := 0,
FORMAT := 0,
P := 1,
OUT => #sHour);
END_IF;
#sMinute := '';
IF #stSystemTime.MINUTE < 10 THEN
VAL_STRG(IN := #stSystemTime.MINUTE,
SIZE := 1,
PREC := 0,
FORMAT := 0,
P := 1,
OUT => #sMinute);
#sMinute := CONCAT(IN1 := '0', IN2 := #sMinute);
ELSE
VAL_STRG(IN := #stSystemTime.MINUTE,
SIZE := 2,
PREC := 0,
FORMAT := 0,
P := 1,
OUT => #sMinute);
END_IF;
#sSecond := '';
IF #stSystemTime.SECOND < 10 THEN
VAL_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);
边栏推荐
- 采集抖音视频
- EasyGBS主子码流都为H.265时,切换出现花屏如何解决?
- Three ways for redis to realize current limiting
- [to.Net] C set class source code analysis
- 原生js打造日程表-支持鼠标滚轮滚动选择月份-可以移植到任何框架中
- Ubuntu14 install MySQL and configure root account local and remote access
- Learning notes - steps of JDBC connection database operation
- [go ~ 0 to 1] day 4 June 30 defer, structure, method
- 【Go ~ 0到1 】 第五天 7月1 类型别名,自定义类型,接口,包与初始化函数
- Learn MySQL from scratch - database and data table operations
猜你喜欢
Thesis reading [distinctive late semantic graph for video capturing]
求各种极限的方法
【To .NET】C#集合类源码解析
[go ~ 0 to 1] day 5 July 1 type alias, custom type, interface, package and initialization function
Solidity - 算术运算的截断模式(unchecked)与检查模式(checked)- 0.8.0新特性
Bao, what if the O & M 100+ server is a headache? Use Xingyun housekeeper!
nacos配置文件发布失败,请检查参数是否正确的解决方案
Lake Shore低温恒温器的氦气传输线
从零开始学 MySQL —数据库和数据表操作
Dlib+Opencv库实现疲劳检测
随机推荐
从零开始学 MySQL —数据库和数据表操作
Dom4j parsing XML, XPath retrieving XML
How to redraw the header of CListCtrl in MFC
Thesis reading [distinctive late semantic graph for video capturing]
精耕渠道共謀發展 福昕攜手偉仕佳傑開展新產品培訓大會
Getting started with kubernetes command (namespaces, pods)
XML syntax, constraints
MATLAB中subplot函数的使用
Detailed explanation of JUnit unit test framework
测试自学人必看:软件测试如何找测试项目?
English grammar_ Adjective / adverb Level 3 - precautions
The use of subplot function in MATLAB
EasyGBS主子码流都为H.265时,切换出现花屏如何解决?
The difference between indexof and includes
Lake shore M91 fast hall measuring instrument
ffmpeg 音频相关命令
XML语法、约束
Lake Shore continuous flow cryostat transmission line
Helium transmission line of lake shore cryostat
Lumiprobe free radical analysis h2dcfda instructions