• <label id="pxtpz"><meter id="pxtpz"></meter></label>
      1. <span id="pxtpz"><optgroup id="pxtpz"></optgroup></span>

        當前位置:雨林木風下載站 > 技術開發(fā)教程 > 詳細頁面

        ASP.NET中處理datetime的一些通用函數(shù)

        ASP.NET中處理datetime的一些通用函數(shù)

        更新時間:2022-05-09 文章作者:未知 信息來源:網(wǎng)絡 閱讀次數(shù):

        'Uses the Timespan method to subtract a certain number of days
        Function Date1()
             Dim NewTime as DateTime
             NewTime = DateTime.Now.Subtract( New TimeSpan(7, 0, 0, 0) )
             NewTime = NewTime.Format("MM/dd/yyyy", DateTimeFormatInfo)
             response.write(NewTime)
        End Function

        'Uses the AddDays method to subtract X number of days
        Public Function Date2()
          Dim NewTime as DateTime
          NewTime = DateTime.Now.AddDays(-7)
          Dim s as string = NewTime
          return s
        End Function

        'Thanks to Paul Czywczynski for this idea
        'This probably (In My opinion) Offers the most flexibility found so far
        'Change where the MM/dd/yyyy to whatever
        'response.write(System.String.Format("{0:d}",NewTime))
        'would return just the name of the Day
        Function Date3()
          Dim NewTime as DateTime = now.addDays(-7)
          response.write(System.String.Format("{0:MM/dd/yyyy}",NewTime))
        End Function


        Function Date4()
        Dim NewTime as DateTime
          NewTime = now.addDays(-7)
          return NewTime.ToString()
        End Function

        'Uses the toLongTimeString method
        Public Function Date5()
          Dim NewTime as DateTime
          NewTime = Now()
          return newtime.toLongTimeString()
        End Function

        'Uses the toShortTimeString method
        Public Function Date6()
          Dim NewTime as DateTime
          NewTime = Now()
          return newtime.toShortTimeString()
        End Function

        'Uses the toLongDateString method
        Public Function Date7()
          Dim NewTime as DateTime
          NewTime = Now()
          return newtime.toLongDateString()
        End Function

        'Uses the toShortDateString method
        Public Function Date8()
          Dim NewTime as DateTime
          NewTime = Now()
          return newtime.toShortDatestring()
        End Function

        'Uses FormatDateTime function General format
        Function Date9()
          Dim NewTime as DateTime
          NewTime = DateTime.Now.Subtract( New TimeSpan(7, 0, 0, 0) )
          return formatdatetime(NewTime, 0)
        End Function

        'Uses FormatDateTime function LongDate format
        Function Date10()
          Dim NewTime as DateTime
          NewTime = DateTime.Now.Subtract( New TimeSpan(7, 0, 0, 0) )
          return formatdatetime(NewTime, 1)
        End Function

        'Uses FormatDateTime function ShortDate format
        Function Date11()
          Dim NewTime as DateTime
          NewTime = DateTime.Now.Subtract( New TimeSpan(7, 0, 0, 0) )
          return formatdatetime(NewTime, 2)
        End Function

        'Uses FormatDateTime function LongTime format
        Function Date12()
          Dim NewTime as DateTime
          NewTime = DateTime.Now.Subtract( New TimeSpan(7, 0, 0, 0) )
          return formatdatetime(NewTime, 3)
        End Function

        'Uses FormatDateTime function ShortTime format
        Function Date13()
          Dim NewTime as DateTime
          NewTime = DateTime.Now.Subtract( New TimeSpan(7, 0, 0, 0) )
          return formatdatetime(NewTime, 4)
        End Function

        'Bring Back just the name of the Day
        Function Date14()
          Dim NewTime as DateTime = now.addDays(-7)
          dim s as string
          s = (System.String.Format("{0:dddd}",NewTime))
          Return s
        End Function

        'Returns the Integer of what day of week
        Function Date15()
          Dim MyDate as DateTime
          Dim MyWeekDay as Integer
          MyDate = Now.AddDays(-5)
          MyWeekDay = Weekday(MyDate)   
          return MyWeekDay
        End Function

        'Returns the Month Integer
        Function Date16()
          Dim MyDate as DateTime
          Dim MyMonth as Integer
          MyDate = Now.AddDays(-5)
          MyMonth = Month(MyDate)   
          return MyMonth
        End Function

        'Returns just a formatted string
        'This method provides just formatting but
        'Very flexible with not a lot of code
        Function Date17()
          Dim MyDate as String
          MyDate = Format(Now(), "yyyy")
          return MyDate
        End Function
        </script>

        溫馨提示:喜歡本站的話,請收藏一下本站!

        本類教程下載

        系統(tǒng)下載排行

        主站蜘蛛池模板: 国产精品久久亚洲一区二区| 亚洲一级毛片视频| 国产精品V亚洲精品V日韩精品 | 久久精品国产99国产精品亚洲| 特级无码毛片免费视频尤物| 成年女人看片免费视频播放器| 国产精品免费视频网站| 亚洲精品无码久久一线| 亚洲欧洲日本国产| 久久精品成人免费国产片小草| 久久九九兔免费精品6| 免费人成在线观看网站视频| 久久久久亚洲AV无码专区首JN| 精品国产亚洲第一区二区三区 | 99在线热视频只有精品免费| 日本a级片免费看| 91亚洲一区二区在线观看不卡 | 免费大片av手机看片| 国内精自视频品线六区免费 | 亚洲精品视频免费看| 一个人看的www免费在线视频| 国产福利视精品永久免费| 亚洲av极品无码专区在线观看| 国产精品色午夜免费视频| 成人国产精品免费视频| 亚洲av无码成人精品区在线播放| 亚洲精品视频在线免费| 国产大片91精品免费观看男同| 一级a性色生活片久久无少妇一级婬片免费放 | 在线免费一区二区| 亚洲最新黄色网址| 女人毛片a级大学毛片免费| 伊人久久国产免费观看视频| 久久亚洲国产成人亚| 中文字幕在线成人免费看| 久久亚洲私人国产精品| 日本免费一区二区三区四区五六区| 亚洲成A∨人片在线观看无码| 五月婷婷亚洲综合| 国产成人亚洲精品91专区高清| 国产av无码专区亚洲av桃花庵|