A-A+
设有如下变量声明:Dim TestDate As Date 为变量TestDate正确赋值的
问题详情
设有如下变量声明:Dim TestDate As Date,为变量TestDate正确赋值的表达式是()。
A.TestDate=#1/1/2007#
B.TestDate#"1/1/2007"#
C.TestDate=date("1/1/2002")
D.TestDate=Format("m/d/yy"."1/1/2002")请帮忙给出正确答案和分析,谢谢!
参考答案
正确答案:A
解析:使用日期型数据常量时需要用“#”括起。Date函数不能带参数。Format函数将字符串转换为日期形式的格式是Format(expression[,format]-[,firstofweek[,firstweekofyear]])。