'This code can be used when you want to find any specific date based on day of month
'like first monday of month,second tues day of month etc.
'declare first day of month
Dim M As String = "9"
Dim Y As String = "2011"
Dim fdm As DateTime = Convert.ToDateTime(M & "/01/" & Y)
'if suppose you have to find second friday of a month then use
fdm = fdm.AddDays(7) 'so that you will get a date of second week
'then loop to find the day specified as shown below
While Not fdm.DayOfWeek.ToString().ToLower().Contains("friday")
fdm = fdm.AddDays(1) 'move forward one day untill u get the specified Day
End While
lblDate.Text = fdm.ToString()
'similarly add 11 days for 3rd day, 21 days for 4th day.
'for first day do not add any day
Showing posts with label C#. Show all posts
Showing posts with label C#. Show all posts
Wednesday, April 7, 2010
Get date for specified day of month in asp.net
Labels:
Asp.Net,
C#,
Day of month,
VB.NET,
Visual Studio
Wednesday, November 12, 2008
Boxing and UnBoxing
Converting a value type to reference type is called Boxing. Unboxing is an explicit operation.
Example :
class A
{
static void Main()
{
int i = 1;
object o = i; // boxing
int j = (int) o; // unboxing
}
}
Example :
class A
{
static void Main()
{
int i = 1;
object o = i; // boxing
int j = (int) o; // unboxing
}
}
Subscribe to:
Posts (Atom)