成人AV在线无码|婷婷五月激情色,|伊人加勒比二三四区|国产一区激情都市|亚洲AV无码电影|日av韩av无码|天堂在线亚洲Av|无码一区二区影院|成人无码毛片AV|超碰在线看中文字幕

如何以6位數(shù)表示期次

在許多企業(yè)管理系統(tǒng)開(kāi)發(fā)中,很多報(bào)表設(shè)計(jì)的數(shù)據(jù)提取方式都需要用到期次的概念。而使用6位數(shù)的期次來(lái)表示是一種常見(jiàn)的方法。具體地說(shuō),當(dāng)月1號(hào)(含1號(hào))開(kāi)始到當(dāng)月31號(hào)(含31號(hào))為止算一個(gè)當(dāng)期次。為實(shí)現(xiàn)這個(gè)

在許多企業(yè)管理系統(tǒng)開(kāi)發(fā)中,很多報(bào)表設(shè)計(jì)的數(shù)據(jù)提取方式都需要用到期次的概念。而使用6位數(shù)的期次來(lái)表示是一種常見(jiàn)的方法。具體地說(shuō),當(dāng)月1號(hào)(含1號(hào))開(kāi)始到當(dāng)月31號(hào)(含31號(hào))為止算一個(gè)當(dāng)期次。

為實(shí)現(xiàn)這個(gè)功能,我們需要編寫(xiě)一段代碼。其中,包括了上期的V_shangqi和本期的V_benqi的處理。如果當(dāng)前日期的月份是兩位數(shù),則直接將年份和月份拼接在一起即可。否則,還需要加上0作為占位符。以下是代碼示例:

if len(cstr(month(date))) 2 then

V_benqi cstr(year(date)) cstr(month(date))

else

V_benqi cstr(year(date)) "0" cstr(month(date))

end if

if len(cstr(month(date))) 1 then

if cint(month(date)) 1 then

V_shangqi cstr(int(year(date)) - 1) "12"

else

V_shangqi cstr(year(date)) "0" cstr(int(month(date))-1)

end if

else

if cint(month(date)) 10 then

V_shangqi cstr(year(date)) "09"

else

V_shangqi cstr(year(date)) cstr(int(month(date))-1)

end if

end if

根據(jù)客戶要求自定義范圍為一個(gè)期次

除了正常的1號(hào)到31號(hào)為一個(gè)當(dāng)期次的時(shí)間范圍外,還有可能根據(jù)客戶的要求進(jìn)行自定義。例如,某些公司規(guī)定到本月27號(hào)為止就是上個(gè)月的最后一天。此時(shí),我們需要稍微改動(dòng)一下代碼來(lái)實(shí)現(xiàn)自定義范圍為一個(gè)期次的功能。

假設(shè)以上月27日(含上月27號(hào))開(kāi)始到本月26號(hào)(含26號(hào))為本期次的表示方法。以下是修改后的代碼示例:

if day(date) < 27 then

if len(cstr(month(date))) 2 then

V_benqi cstr(year(date)) cstr(month(date))

else

V_benqi cstr(year(date)) "0" cstr(month(date))

end if

else

if cint(month(date)) 9 or cint(month(date)) 10 or cint(month(date)) 11 then

V_benqi cstr(year(date)) cstr(int(month(date)) 1)

elseif cint(month(date)) 12 then

V_benqi cstr(int(year(date)) 1) "01"

else

V_benqi cstr(year(date)) "0" cstr(int(month(date)) 1)

end if

end if

if len(cstr(month(date))) 1 then

if cint(month(date)) 1 then

V_shangqi cstr(int(year(date))-1) "12"

else

V_shangqi cstr(year(date)) "0" cstr(int(month(date))-1)

end if

else

if cint(month(date)) 10 then

V_shangqi cstr(year(date)) "09"

else

V_shangqi cstr(year(date)) cstr(int(month(date))-1)

end if

end if

總結(jié)

以上是關(guān)于ASP項(xiàng)目筆記之:“6位數(shù)的期次表示”的內(nèi)容。在企業(yè)軟件開(kāi)發(fā)中,期次的概念和應(yīng)用十分常見(jiàn)。針對(duì)不同的需求,我們可以采用不同的代碼來(lái)實(shí)現(xiàn)期次的表示和計(jì)算,從而滿足用戶的需求。

標(biāo)簽: