|
Parsing and validating string dates
|
Total Hit (2829) |
If you have a string variable that should specify a date (asked in input to the user, for example), you can parse the string and get a Date variable by using the Date.Parse method. If the input string is not in a valid format, this method throws an exception though. Follows a routine that parses a s
....Read More |
Rating
|
|
|
|
Age - Evaluating the age of a person, given his/her birth date
|
Total Hit (2139) |
«Code LangId=2»' Evaluate the age of a person, given his/her birth date
' Example: Debug.WriteLine(Age(#9/28/1980#)) ' => 22
Function Age(ByVal birthDate As Date, Optional ByVal currentDate As Date = #1/1/ _
1900#, Optional ByVal exactAge As Boolean = True) As Integer
If currentDate
....Read More |
Rating
|
|
|
|
|
EasterDate - Evaluating the Easter date for a given year
|
Total Hit (2780) |
«Code LangId=2»' Evaluate the Easter date for a given year
' Example: MessageBox.Show(EasterDate(2003).ToLongDateString())
Function EasterDate(ByVal year As Integer) As DateTime
Dim g, c, h, i, j, l, month, day As Integer
g = year Mod 19
c = year \ 100
h = ((c - (c \ 4) -
....Read More |
Rating
|
|
|
|
Using "Date" intervals in VB.NET
|
Total Hit (2548) |
The versatile Date datatype in VB.NET provides a large amount of built in functionality to manipulate dates and times. The ability to add, subtract and compare date values is very useful in particular.
For example, suppose you are managing hundreds of clients in an insurance company. Since insu
....Read More |
Rating
|
|
|
Convert dates entered by user as strings to VB Date values.
|
Total Hit (3692) |
This code formats a date string entered by the user, adding slashes and correct number of year digits and converts it to a proper date format.
You can use the following code to make your user interface more friendly. It will help you in correcting and preventing mistakes over what date is entered.
....Read More |
Rating
|
|
|
Converting a date string entered by the user to a VB Date value.
|
Total Hit (2328) |
This code formats a date string entered by the user, adding slashes and correct number of year digits and converts it to a proper date format.
You can use the following code to make your user interface more friendly. It will help you in correcting and preventing mistakes over what date is entered.
....Read More |
Rating
|
|
|
Using Date values in VB.NET
|
Total Hit (2254) |
The versatile Date datatype in VB.NET provides a large amount of built in functionality to manipulate dates and times. The ability to add, subtract and compare date values is very useful in particular.
For example, suppose you are managing hundreds of clients in an insurance company. Since insu
....Read More |
Rating
|
|