•      Powered by
 

Display Specific parts of the Date(DAY, MONTH, TIME)

Back to the article

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

 

Method #1 -- Various Ways of Subtracting Time from a Current Date Method #2 -- General Formatting Techniques 
Method #3 -- Using FormatDateTime Function Method #4 -- Display Specific parts of the Date(DAY, MONTH, TIME)
 

tio

Terms of Use | Privacy Statement ©2005-2006 IISLogs.com. All rights reserved - Powered by IIS7 - info @ www.IIS.net