發表文章

目前顯示的是 11月, 2018的文章

【ASP】取得年月的最後一天

取得某年 某 月的最後一天 ' Returns the last day of the month. Takes into account leap years ' Usage: LastDay(Month, Year) Function LastDay (MyMonth, MyYear)   'MyYear用民國年算法  'LastDay=day(dateserial(MyYear+1911,MyMonth+1,0))  'MyYear用西元年算法   LastDay=day(dateserial(MyYear,MyMonth+1,0))   '以上紅色字...2擇一   End Function Ex : 2018年11月的最後一天 Response.Write      LastDay (11,2018)   =>30 Ex : 2018年2月的最後一天 Response.Write      LastDay (2,2018)   =>28

【ASP】檢查字串是否空值或Null值

寫程式經常會遇到須判斷字串是否為空值或null值,因時常會用到,故寫成函式(Function),方便引用之。 '檢查字串是否空值或Null值,若是則true;否則false Function check_space (v_ask)      if v_ask = "" or isnull(v_ask) then            check_space = true      else            check_space = false      end if End Function Ex:判斷計畫代碼是否有值,若有進行代碼轉換 if check_space (plan_id) then    plan_name=""                 '計畫名稱為空值 else    plan_name=GetName(plan_id)   '計畫代碼轉換成計畫名稱 end if     PS:GetName()是個人自定函數,在此文不具任何意義