(十)If控制语句

一、If流程控制语句
这里写图片描述
①Date函数:Returns the current system date.格式:2018-6-8
②Month(date)函数:
Returns a whole number between 1 and 12, inclusive, representing the month of the year.
The date argument is any expression that can represent a date. If date contains Null, Null is returned.
③Weekday(date, [firstdayofweek])
Returns a whole number representing the day of the week.
Arguments
date
Any expression that can represent a date. If date contains Null, Null is returned.
firstdayofweek
A constant that specifies the first day of the week. If omitted, vbSunday is assumed.
周日为第一天,周六为第七天

'if ...then....End If
Dim myDate
myDate=Date
'Msgbox myDate
Dim vMon
vMon=Month(myDate)
If vMon=12Then
      Msgbox "已经12月了,很冷"
End If



'if ....then........Else........End If
Dim vMon
vMon=Month("2018-6-8")
If vMon=12Then
      Msgbox "已经12月了,很冷"
Else
      Msgbox  "月份一定在12月份之前"
End If



'if ....then........ElseIf.....then.......Else........End If
Dim vDay
vDay=Weekday(Date)
If vDay=6 Then
    Msgbox."时间过的真快,又到周五了"
ElseIf  vDay>1 and vDay<6 then
    Msgbox "明天要上班"
Else
    Msgbox "哈哈,周末"
End If

二、在QTP中,若要获取测试软件中的数据,用Output Value,将此值赋值给变量就可以对该值进行操作了。

order_Sum=DataTable("order_Sum",dtLocalSheet)   
posted @ 2018-06-08 21:23  测试开发分享站  阅读(152)  评论(0编辑  收藏  举报