ANSY获取当前时间字符串

!! ========== 获取当前时分的字符串,都是两位数字 ====== write by xdd====
*get,timeValue,active,,time,wall                                   !=
timeStr0 = chrval(timeValue)                                       !=
NLoc = strpos(timeStr0,'.')                                        !=
!!! hourStr                                                        !=
*if,NLoc,eq,0,then                                                 !=
    hourStr = timeStr0                                             !=
    timeStr0 = strcat(timeStr0,'.0')                               !=
*elseif,NLoc,eq,2,then                                             !=
    hourStr = strcat('0',strsub(timeStr0,1,1))                     !=
*else                                                              !=
    hourStr = strsub(timeStr0,1,2)                                 !=
*endif                                                             !=
!! minuStr0                                                        !=
minuStr0 = strsub(timeStr0,NLoc+1,NLoc+2)                          !=
minuStr = chrval(valchr(minuStr0)/100*60)                          !=
NLoc = strpos(minuStr,'.')                                         !=
*if,NLoc,eq,2,then                                                 !=
    minuStr = minuStr                                              !=
*elseif,NLoc,eq,2,then                                             !=
    minuStr = strcat('0',strsub(minuStr,1,1))                      !=
*else                                                              !=
    minuStr = strsub(minuStr,1,2)                                  !=
*endif                                                             !=
!! merge                                                           !=
timeStr = strcat(hourStr,minuStr)                                  !=
!! ========== 获取当前时分的字符串,都是两位数字 ====== write by xdd====

 

posted @ 2021-09-09 20:55  xdd1997  阅读(106)  评论(0编辑  收藏  举报