 |
不是很清楚你的意思,如果你不知道如何获得日期字段的数据,你可以定义一个Date型或Variant型变量来获得日期型字段的值。
如果你的意思是只想获得日期数据的日期部分,不要时间部分,你可以用下面的函数:
CDate(Int(YourDate))
实际上Date型数据是一个浮点数,小数点前面的部分表示日期,后面的部分表示时间。
NewViewStudio的意见:
Format (YourDate,"yyyy-mm-dd hh:nn:ss")
if 你想得到"年" then 只写"yyyy" 或 "yy"
if 你想得到"月" then 只写"mm" 或 "m"
if 你想得到"日" then 只写"dd" 或 "d"
if 你想得到"小时" then 只写"hh" 或 "h"
if 你想得到"分" then 只写"nn" 或 "n"
if 你想得到"秒" then 只写"ss" 或 "s"
if 你想得到对应的某个部分 then 只写相应的部分
如果你想得到对应的数值则使用Val(Format(....))
此问题由李海回答。
附加关键字:编程, 源程序, programming, source code, Visual Basic, VB, 其他方面, 。
|