`
xitong
  • 浏览: 6187977 次
文章分类
社区版块
存档分类
最新评论

QTP获取系统时间并自定义格式

 
阅读更多
function GetDateTime(Nowstr)
Dim Currentdatetime
Dim YY 'Year
Dim MM 'Month
Dim DD 'Day
Dim HH 'Hour
Dim Min 'MInute
Dim SS 'Second
Currentdatetime=now()
YY=Year(Currentdatetime)
MM=Month(Currentdatetime)
If MM<10 Then
MM="0"&MM
End If
DD=Day(Currentdatetime)
If DD<10 Then
DD="0"&DD
End If
HH=Hour(Currentdatetime)
If HH<10 Then
HH="0"& HH
End If
Min=Minute(Currentdatetime)
If Min<10 Then
Min="0"&Min
End If
SS=Second(Currentdatetime)
If SS<10 Then
SS="0"&SS
End If
Nowstr=YY&"-"&MM&"-"&DD&" "&HH&":"&Min
end function

分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics