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

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

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>

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

本類教程下載

系統下載排行

主站蜘蛛池模板: 韩国欧美一级毛片免费 | 久久久久久综合成人精品 | 久草久视频| 国产成人免费手机在线观看视频 | 日本中文字幕视频在线看 | 欧美 日韩 国产 成人 在线观看 | 午夜伦理在线 | 综合色伊人 | 欧美αv日韩αv另类综合 | 久久国产这里只精品免费 | 国产精品久久久久网站 | 在线观看国产一区亚洲bd | 伊人久久综合影院首页 | 91久久国产青草亚洲 | 午夜日韩久久影院 | 免费成人高清在线视频 | 国产精品久久国产三级国不卡顿 | 亚洲视频免费观看 | 亚洲欧美日韩在线线精品 | 欧美日韩影院 | 日本不卡视频在线 | 99视频精品全国免费 | 国产xxxxxx久色视频在 | 日韩精品一区二区在线观看 | 一区二区在线不卡 | 日韩视频高清免费看 | 成人免费毛片一区二区三区 | 噜噜噜噜天天狠狠 | 草草影院ccyy国产日本欧美 | 最近中文字幕无吗高清网 | 97久久精品一区二区三区 | 国产精品久久久久久爽爽爽 | www.人人干| 亚洲精品中文字幕午夜 | 91免费国产精品 | 波多野结衣在线观看一码 | 台湾三级毛片 | 国产拍拍拍在线观看视频 | 国产亚洲99影院 | 天天摸天天爽天天澡视频 | 欧洲精品在线观看 |