<script language="vbscript"> function getYMD(dateVar, byref y, byref m, byref d) if(isdate(dateVar)){ dim dt=cdate(dateVar) y=year(dt) m=month(dt) d=day(dt) } end functiondim s="2004-01-31" dim y,m,d getYMD s, y,m,d msgbox y msgbox m msgbox d </script>
更正: dim s="2004-01-31" 错了 应该是: dim s s="2004-01-31"
cuixiping(无心)的VBS,呵呵……不过跟日期格式是没有关系的,只有系统有这种表示法javascript可以这样var d = new Date(Date.parse(value)),不过格式好像比较傻干吗不用三级联动的下拉框呢
function getYMD(dateVar, byref y, byref m, byref d)
if(isdate(dateVar)){
dim dt=cdate(dateVar)
y=year(dt)
m=month(dt)
d=day(dt)
}
end functiondim s="2004-01-31"
dim y,m,d
getYMD s, y,m,d
msgbox y
msgbox m
msgbox d
</script>
dim s="2004-01-31" 错了
应该是:
dim s
s="2004-01-31"