birthdate是什么意思,birthdate中文翻譯,birthdate發(fā)音、用法及例句
?birthdate
birthdate發(fā)音
英:['b?:θde?t] 美:['b?:θde?t]
英: 美:
birthdate中文意思翻譯
n. 出生年月日
ASP里知道生日如何計(jì)算年齡(年月日)
發(fā)錯(cuò)地方了!
隨便在一個(gè)地方調(diào)用一下 BirthdayToAge函數(shù),輸出就可以了!很簡(jiǎn)單的!
ASP里知道生日如何計(jì)算年齡(年月日)
ASP生日計(jì)算年齡 修正版 v1.2 by dflzzp
8-10 17:10
<%
Function BirthdayToAge(BirthDate)
'函數(shù)功能:由出生日期返回歲齡
'入口參數(shù):出生日期
'函數(shù)返回:出錯(cuò)或非正常返回為 vbnullstring,否則為歲齡的字符串
' <1個(gè)月 為 幾天
' <1歲為 幾月零幾天
' <6歲為 幾歲零幾月
'edit by dflzzp
Dim myYear
Dim myMonth
Dim myDay
Dim CurDate
CurDate = Date()
If Not IsDate(BirthDate) Then
BirthdayToAge = vbNullString
Exit Function
else
myYear=year(BirthDate)
myMonth=month(BirthDate)
myDay=day(BirthDate)
End If
If DateDiff("d",BirthDate,CurDate)<=0 Then
BirthdayToAge = ""
Exit Function
End If
diffday=day(BirthDate)-day(CurDate)
diffmonth=DateDiff("m",BirthDate,CurDate)
diffyear=int(diffmonth/12)
diffmonth0=diffmonth mod 12
if(diffday<0) then
if(diffyear>=1) then
BirthdayToAge = diffyear&"歲"&diffmonth0&"月"&abs(diffday)&"天"
elseif(diffmonth>=1) then
BirthdayToAge = diffmonth0&"月"&abs(diffday)&"天"
else
BirthdayToAge = abs(diffday)&"天"
end if
elseif(diffday=0) then
if(diffyear>=1) then
BirthdayToAge = diffyear&"歲"&diffmonth0&"月整"
else
BirthdayToAge = diffmonth0&"月整"
end if
else
diffmonth=diffmonth-1
diffyear=int(diffmonth/12)
diffmonth0=diffmonth mod 12
diffday=DateDiff("d",year(now)&"-"&(month(now)-1)&"-"&day(BirthDate),year(now)&"-"&month(now)&"-"&day(now))
if(diffyear>=1) then
BirthdayToAge = diffyear&"歲"&diffmonth0&"月"&diffday&"天"
elseif(diffmonth>=1) then
BirthdayToAge = diffmonth0&"月"&diffday&"天"
else
BirthdayToAge = diffday&"天"
end if
end if
End Function
%>
使用方法很簡(jiǎn)單,說(shuō)白了就是對(duì)函數(shù)的引用,但要熟悉ASP中時(shí)間的表示方法:
response.Write(BirthdayToAge("2008-6-1")
response.Write(BirthdayToAge("2008/6/1")
response.Write(BirthdayToAge(#2008/6/1#)
response.Write(BirthdayToAge(#6/1/2008#))
以上幾種都行!
本站其他內(nèi)容推薦
1、denim genre lancet sadness endomorph horrendous guff treasury myeloma stable-boy
2、crowing中文翻譯,crowing是什么意思,crowing發(fā)音、用法及例句
3、slowing中文翻譯,slowing是什么意思,slowing發(fā)音、用法及例句
4、get the better of中文翻譯,get the better of是什么意思,get the better of發(fā)音、用法及例句
5、csy是什么意思,cscy縮寫是什么意思,cscy的全稱及含義,cscy全稱意思大全
6、embassy是什么意思,embassy中文翻譯,embassy發(fā)音、用法及例句
7、而[ ér ]字的拼音,部首,組詞,成語(yǔ),筆順,筆畫順序怎么寫
10、orthognathic是什么意思,orthognathic中文翻譯,orthognathic怎么讀、發(fā)音、用法及例句
版權(quán)聲明: 本站僅提供信息存儲(chǔ)空間服務(wù),旨在傳遞更多信息,不擁有所有權(quán),不承擔(dān)相關(guān)法律責(zé)任,不代表本網(wǎng)贊同其觀點(diǎn)和對(duì)其真實(shí)性負(fù)責(zé)。如因作品內(nèi)容、版權(quán)和其它問題需要同本網(wǎng)聯(lián)系的,請(qǐng)發(fā)送郵件至 舉報(bào),一經(jīng)查實(shí),本站將立刻刪除。