日本国产亚洲-日本国产一区-日本国产一区二区三区-日本韩国欧美一区-日本韩国欧美在线-日本韩国欧美在线观看

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

ASP.NET中處理datetime的一些通用函數

ASP.NET中處理datetime的一些通用函數

更新時間:2022-05-09 文章作者:未知 信息來源:網絡 閱讀次數:

'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>

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

本類教程下載

系統下載排行

主站蜘蛛池模板: 亚洲国产精品人久久 | 国产精品免费精品自在线观看 | 国产国产成人精品久久 | 久久这里只精品热免费99 | 多人伦交性欧美精品欧 | 欧美色第一页 | 亚洲欧美高清视频 | 国产在线欧美日韩一区二区 | 国产女人体一区二区三区 | 草久热| 夜夜操综合 | 操操操网 | 中文字幕三区 | 99热这里只有精品国产动漫 | 欧美一级成人毛片视频 | 精品一区二区三区免费 | 亚洲国产欧美日韩精品一区二区三区 | 西西久久 | 美日韩中文字幕 | 欧美在线精品永久免费播放 | 人人狠狠综合88综合久久 | 天天射天天爽 | 国产成人免费影片在线观看 | 日韩精品一区二区三区中文 | 亚洲激情99| 久久亚洲综合色 | 亚洲视频免费看 | 亚洲精品乱码中文字幕无线 | 亚洲精品一区在线观看 | 欧美videofree高清杂交 | 欧美亚洲国产日韩一区二区三区 | 国产 日韩 欧美 综合 | zzzzzz在线日本免费视频 | 欧洲成人r片在线观看 | 亚洲精品中文字幕午夜 | 91av视频网站 | 成人欧美深夜福利视频在线播放 | 亚洲欧洲日本在线 | 在线亚洲日产一区二区 | 99麻豆久久久国产精品免费 | 久久精品最新免费国产成人 |