Calls GetDaysInMonth for the second month in each of five years in each era. : Date Functions « Date Time « VB.Net Tutorial






Imports System
Imports System.Globalization
Imports Microsoft.VisualBasic

Public Class SamplesGregorianCalendar   

   Public Shared Sub Main()
      Dim myCal As New GregorianCalendar()

      Console.Write("YEAR" + ControlChars.Tab)
      Dim y As Integer
      For y = 2001 To 2005
         Console.Write(ControlChars.Tab + "{0}", y)
      Next y

      Console.Write("CurrentEra:")
      For y = 2001 To 2005
         Console.Write(ControlChars.Tab + "{0}", myCal.GetDaysInMonth(y, 2, GregorianCalendar.CurrentEra))
      Next y
      Console.WriteLine()

      Dim i As Integer
      For i = 0 To myCal.Eras.Length - 1
         Console.Write("Era {0}:" + ControlChars.Tab, myCal.Eras(i))
         For y = 2001 To 2005
            Console.Write(ControlChars.Tab + "{0}", myCal.GetDaysInMonth(y, 2, myCal.Eras(i)))
         Next y
         Console.WriteLine()
      Next i

   End Sub  

End Class








5.3.Date Functions
5.3.1.DateAdd: add two date together
5.3.2.Weekday Function
5.3.3.Call to WeekdayName combined with call to Weekday
5.3.4.Determining the weekday of a date
5.3.5.CDate: convert string(8/1/86) to date
5.3.6.CDate: convert string(Tuesday, September 16, 1845 6:45pm) to Date
5.3.7.CDate: convert string(15 July, 1215) to Date
5.3.8.Assign Now() to a date variable
5.3.9.Different date between two dates
5.3.10.TimeOfDay
5.3.11.Calls GetDaysInMonth for the second month in each of five years in each era.
5.3.12.Call IsLeapMonth() for all the months
5.3.13.The FirstDayOfWeek used for the en-US culture
5.3.14.Current week in current year
5.3.15.Call IsLeapMonth for all the months in five years in the current era.