濮阳杆衣贸易有限公司

主頁 > 知識庫 > 日期函數(shù)擴(kuò)展類Ver0.1.1

日期函數(shù)擴(kuò)展類Ver0.1.1

熱門標(biāo)簽:鳳臺百度地圖標(biāo)注店 個(gè)人可以辦理400電話么 武夷山旅游地圖標(biāo)注 怎么在地圖標(biāo)注自己 修改地圖標(biāo)注 萊西電子地圖標(biāo)注 外呼系統(tǒng)API接口 縣域地圖標(biāo)注打印店 金昌電話機(jī)器人價(jià)格
復(fù)制代碼 代碼如下:

%
'轉(zhuǎn)發(fā)時(shí)請保留此聲明信息,這段聲明不并會影響你的速度!
'**************************   【日期擴(kuò)展類】Ver 0.1.1********************************
'開發(fā)人:        Sman、Net Fetch
'開發(fā)日期:        2005-11-11
'版本號:        Ver 0.1.1

'官方網(wǎng)站:http://www.sman.cn     http://www.ad0.cn
'電子郵件:huihui3030@126.com    NetFetchStudio@163.com  
'每日在線QQ:19341293             32050450
'版權(quán)聲明:版權(quán)沒有,盜版不究,源碼公開,歡迎盜版,歡迎你到官方網(wǎng)站來尋求支持。
'如有任何改進(jìn)之處,麻煩轉(zhuǎn)發(fā)或者反饋一份到 huihui3030@126.com、NetFetchStudio@163.com,Thanks!
'詳細(xì)使用說明或范例請見下載附件或到官方站點(diǎn)或Email聯(lián)系下載!
'************************************************************************************

Class DateFunEx

    Private d_
    Private firstweekofyear_
    Private firstdayofweek_

    Private Sub class_initialize()
        d_                     = date() '默認(rèn)當(dāng)前日期
        firstdayofweek_     = 2    'vbMonday
        firstweekofyear_     = 1    '由 1 月 1 日所在的星期開始。
    End Sub

    '屬性 setDate 日期
    Public Property Let setDate(value) 
        On Error Resume Next
        If IsNumeric(value) Then
            value = Cint(value)
            If len(value) 3 Then value = "20"  right("0"value,2)
            value = value  "-1" 
        End If 
        d_ = cDate(value)
    End Property

    '屬性 firstweekofyear 每年的第一周(詳細(xì)設(shè)置請參照VBS手冊)
    Public Property Let firstweekofyear(value)
        firstweekofyear_ = cInt(value)
    End Property

    '屬性 FirstDayofWeek 每周的第一天(詳細(xì)設(shè)置請參照VBS手冊)
    Public Property Let firstdayofweek(value)
        firstdayofweek_ = cInt(value)
    End Property


    '------------------------------
    ' 功能說明:算第幾周的星期幾是幾號
    ' 參數(shù)說明:y 年,w周,week 星期 (星期一1 星期天7)
    '------------------------------
    Public Function GetWeekDate(y, w, DayofWeek)
        Dim NewYearDay
        NewYearDay = CDate(y  "-1-1") '元旦
        GetWeekDate = ((NewYearDay - Weekday(NewYearDay, firstdayofweek_)) + (w - 1) * 7 + DayofWeek)
    End Function

    '------------------------------
    ' 功能說明:獲得某年某月的天數(shù)
    '------------------------------
    Public Function GetMonthDayCount()
        GetMonthDayCount = DateDiff("d", d_, DateAdd("m", 1, d_))
    End Function

    '------------------------------
    ' 功能說明:得到某年某月的第一天
    '------------------------------
    Public Function GetMonthFirstDay()
        GetMonthFirstDay = CDate( Year(d_)  "-"  Month(d_)  "-1")
    End Function

    '------------------------------
    ' 功能說明:得到某年的某月的最后一天
    '------------------------------
    Public Function GetMonthLastDay()
        GetMonthLastDay = CDate( Year(d_)  "-"Month(d_)  "-"  DateDiff("d", d_, DateAdd("m", 1, d_)))
    End Function

    '------------------------------
    ' 功能說明:某日所在的周的第一天的日期
    '------------------------------
    Public Function WeekFirstDay()
        WeekFirstDay = GetWeekDate(Year(d_), DatePart("ww", d_,firstdayofweek_,firstweekofyear_), 1)
    End Function

    '------------------------------
    ' 功能說明:某日所在的周的第最后一天的日期
    '------------------------------
    Public Function WeekLastDay()
        WeekLastDay = GetWeekDate(Year(d_), DatePart("ww", d_,firstdayofweek_,firstweekofyear_), 7)
    End Function

End Class
%>

測試頁面:
復(fù)制代碼 代碼如下:

%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%>
% Option Explicit %>
!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
html xmlns="http://www.w3.org/1999/xhtml">
head>
meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
title>Test_clsDateFunEx/title>
/head>

body>
!--#include file="clsDateFunEx.asp" -->
%
Dim myDateFun,strDate 
strDate = "2005-4-1"
Set myDateFun = new DateFunEx 
    myDateFun.setDate = strDate
    Response.write "2006年第2周的星期一是幾號:"  _
                         myDateFun.GetWeekDate(2006,2,1) "br>"
    Response.Write "2005年4月的天數(shù):"_
                         myDateFun.GetMonthDayCount  "br>"
    Response.Write "2005年4月的第一天:"_
                         myDateFun.GetMonthFirstDay  "br>"
    Response.Write "2005年4月的最后一天:"_
                         myDateFun.GetMonthLastDay  "br>"
    Response.Write "2005年4月1日所在的周的第一天的日期:"_
                         myDateFun.WeekFirstDay  "br>"
    Response.Write "2005年4月1日所在的周的第最后一天的日期:"  _
                        myDateFun.WeekLastDay  "br>"
Set myDateFun = Nothing
%>
br>br>br>
/body>
/html>


下載此文件

標(biāo)簽:邢臺 涼山 南京 上海 通遼 楚雄 清遠(yuǎn) 赤峰

巨人網(wǎng)絡(luò)通訊聲明:本文標(biāo)題《日期函數(shù)擴(kuò)展類Ver0.1.1》,本文關(guān)鍵詞  日期,函數(shù),擴(kuò)展,類,Ver0.1.1,;如發(fā)現(xiàn)本文內(nèi)容存在版權(quán)問題,煩請?zhí)峁┫嚓P(guān)信息告之我們,我們將及時(shí)溝通與處理。本站內(nèi)容系統(tǒng)采集于網(wǎng)絡(luò),涉及言論、版權(quán)與本站無關(guān)。
  • 相關(guān)文章
  • 下面列出與本文章《日期函數(shù)擴(kuò)展類Ver0.1.1》相關(guān)的同類信息!
  • 本頁收集關(guān)于日期函數(shù)擴(kuò)展類Ver0.1.1的相關(guān)信息資訊供網(wǎng)民參考!
  • 推薦文章
    通化市| 鞍山市| 乌鲁木齐市| 大田县| 霍山县| 哈尔滨市| 杭锦后旗| 左贡县| 垫江县| 滁州市| 甘德县| 拉萨市| 兴海县| 德安县| 叙永县| 靖西县| 桑植县| 闸北区| 义马市| 牙克石市| 台州市| 天等县| 济阳县| 资阳市| 榕江县| 马山县| 隆德县| 德令哈市| 富宁县| 双峰县| 莫力| 乐安县| 栾城县| 吴旗县| 钟祥市| 天峻县| 泰兴市| 美姑县| 万山特区| 长子县| 文水县|