当前位置:网站首页>博途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);
边栏推荐
- ffmpeg常用命令(二)
- 学习笔记-JDBC连接数据库操作的步骤
- Parallelism, concurrency and life cycle of threads
- Lake Shore - crx-em-hf low temperature probe station
- MFC中如何重绘CListCtrl的表头
- More information about M91 fast hall measuring instrument
- Introduction to relevant processes and functions of wechat official account development
- 703. 数据流中的第 K 大元素
- Manufacturing SRM management system supplier all-round closed-loop management, to achieve procurement sourcing and process efficient collaboration
- win10下使用msys+vs2019编译ffmpeg源码
猜你喜欢
nacos启动失败问题解决与总结
精耕渠道共谋发展 福昕携手伟仕佳杰开展新产品培训大会
商业智能BI开发和报表开发有什么本质区别?
Dlib+Opencv库实现疲劳检测
MySQL common graphics management tools | dark horse programmers
axure不显示元件库
论文阅读【Discriminative Latent Semantic Graph for Video Captioning】
新版国标GB28181视频平台EasyGBS如何配置WebRTC视频流格式播放?
正则表达式=Regex=regular expression
Lake shore M91 fast hall measuring instrument
随机推荐
GB28181的NAT穿透
241. Different Ways to Add Parentheses
物联网平台thingsboard搭建学习记录
Detailed explanation of JUnit unit test framework
Reading the paper [learning to discretely compose reasoning module networks for video captioning]
Shell高级进阶
[go ~ 0 to 1] day 5 July 1 type alias, custom type, interface, package and initialization function
求各种极限的方法
Learning records of building thingsboard, an Internet of things platform
[6.24-7.1] review of wonderful technical blog posts in the writing community
Solution and summary of Nacos startup failure
[pytorch record] automatic hybrid accuracy training torch cuda. amp
下载(导出)pdf模板文件(比如:审批单),报错:Invalid nested tag *** found, expected closing tag ***
torch.nn.functional.interpolate函数
118. 杨辉三角
Parallelism, concurrency and life cycle of threads
Cdga | if you are engaged in the communication industry, you should get a data management certificate
Instagram 为何从内容共享平台变成营销工具?独立站卖家如何利用该工具?
Lake Shore - crx-em-hf low temperature probe station
English grammar_ Adjective / adverb Level 3 - precautions