单选题
设有如下变量声明:
Dim TestDate As Date
为变量TestDate正确赋值的表达式是( )。
A、
TestDate=#1/1/2002#
B、
TestDate#"1/1/2002"#
C、
TestDate=date("1/1/2002")
D、
TestDate=Format(m/d/yy",''1/1/2002")
【正确答案】
A
【答案解析】
[解析] 日期型数据单独存在时前后需要用#号。选项B书写错误;Date函数不能带参数,选项C错误;Format函数可以将字符串数据转换为日期形式,但是该函数的格式是:Format(expression [,format][,firstofweek[,firstweekofyear]]),即选项D中两个参数的顺序出现错误。正确答案为选项A。
提交答案
关闭