how to get odd saturday in a month in c#
C#
int year = 2016; // 366 days in 2016 because leap year
DateTime yearStart = new DateTime(year, 1, 1);
int daysInYear = (yearStart.AddYears(1) - yearStart).Days; // 366
var oddSaturdays = Enumerable.Range(0, daysInYear)
.Select(day => yearStart.AddDays(day))
.Where(date => date.Day % 2 == 1 && date.DayOfWeek == DayOfWeek.Saturday);
foreach (DateTime oddSaturday in oddSaturdays)
{
// ...
string sql = string.Format("INSERT INTO {0}.[WEEKEND] ([DATE],[DAYNAME]) VALUES (@DATE, @DAYNAME)", schemaname);
using (var cmd = new SqlCommand(sql, con))
{
cmd.Parameters.Add("@DATE", SqlDbType.Date).Value = oddSaturday;
cmd.Parameters.Add("@DAYNAME", SqlDbType.VarChar).Value = oddSaturday.DayOfWeek.ToString();
int inserted = cmd.ExecuteNonQuery();
}
// ...
}
Also in C#:
- Title
- interpolate rotation unity3d
- Category
- C#
- Title
- transform object according to its parent unity
- Category
- C#
- Title
- c# timespan
- Category
- C#
- Title
- how to store some variables on the device in unity
- Category
- C#
- Title
- c# fold list
- Category
- C#
- Title
- c# winform remove button border
- Category
- C#
- Title
- read configuration workerservice
- Category
- C#
- Title
- c# authorize attribute
- Category
- C#
- Title
- leantween id
- Category
- C#
- Title
- Unity how to put IEnumerator in update and loop once with yeild return new waitforseconds
- Category
- C#
- Title
- unity create a child object
- Category
- C#
- Title
- take screenshot in c#
- Category
- C#
- Title
- run async methods within a sync process
- Category
- C#
- Title
- c# webrequest cookies
- Category
- C#
- Title
- how to chagne rotation in unity
- Category
- C#
- Title
- find mongodb c# with task T
- Category
- C#
- Title
- javascript append
- Category
- C#
- Title
- length of a string c#
- Category
- C#
- Title
- instantiate object in circle
- Category
- C#
- Title
- blazor display validation message
- Category
- C#
- Title
- create object in c#
- Category
- C#
- Title
- c# razor add disabled to button if
- Category
- C#
- Title
- C# .net core convert int to enum
- Category
- C#
- Title
- html hidden text
- Category
- C#
- Title
- variables
- Category
- C#
- Title
- how to convert a number to 2 decimal places in c#
- Category
- C#
- Title
- No context type was found in the assembly
- Category
- C#
- Title
- array copy c#
- Category
- C#
- Title
- sum the digits in c#
- Category
- C#
- Title
- How can you learn C# on your own
- Category
- C#
- Title
- How to look at an object unity
- Category
- C#
- Title
- vb.net tostring numeric format string
- Category
- C#
- Title
- how to make if statement c#
- Category
- C#
- Title
- xml node update attribute value c#
- Category
- C#
- Title
- how to insert into a list c#
- Category
- C#
- Title
- c# webcam
- Category
- C#
- Title
- unity delete specific text in a string
- Category
- C#
- Title
- c#if
- Category
- C#
- Title
- c# xml file builder
- Category
- C#
- Title
- c# mathf.ceiling
- Category
- C#
- Title
- how to print statement in c#
- Category
- C#
- Title
- C# public 2d array
- Category
- C#
- Title
- c# adding to a list
- Category
- C#
- Title
- binding c#
- Category
- C#
- Title
- unity collider2d contains point
- Category
- C#
- Title
- unity fall damage c#
- Category
- C#
- Title
- how to convert from hexadecimal to binary in c#
- Category
- C#
- Title
- c# format string to date yyyymmdd
- Category
- C#
- Title
- decimal to string whole number c#
- Category
- C#
- Title
- c# datatable copy selected rows to another table
- Category
- C#
- Title
- repeater itemdatabound event in c#
- Category
- C#
- Title
- c# creating a data recovery software
- Category
- C#
- Title
- c# print expression tree
- Category
- C#
- Title
- c# string list contains
- Category
- C#
- Title
- copy to clipboard unbity
- Category
- C#
- Title
- how to crouch in unity
- Category
- C#
- Title
- how to retrive an enum string value instead of number in c# controller
- Category
- C#
- Title
- c# tab character
- Category
- C#
- Title
- f string C#
- Category
- C#
- Title
- arry in c#
- Category
- C#
- Title
- how to make an object move in unity
- Category
- C#
- Title
- c# datafield change cell background color
- Category
- C#
- Title
- bold caption latex
- Category
- C#
- Title
- unity c# run a command then wait
- Category
- C#
- Title
- bool toggle unity c#
- Category
- C#
- Title
- unity how to change the text on a button
- Category
- C#
- Title
- c# convert double to int
- Category
- C#
- Title
- C# function return datareader
- Category
- C#
- Title
- datatable return column names
- Category
- C#
- Title
- ignore fakeiteasy
- Category
- C#
- Title
- c# declare an int list
- Category
- C#
- Title
- c# get current date
- Category
- C#
- Title
- unity print to console
- Category
- C#
- Title
- how do i foreach c#
- Category
- C#
- Title
- unity onselect gizmos wireframe
- Category
- C#
- Title
- c# store generic type without arguments
- Category
- C#
- Title
- unity up arrow input
- Category
- C#
- Title
- unity delete all children
- Category
- C#
- Title
- copy a list C#
- Category
- C#
- Title
- itext7 pdfwriter outputstream c#
- Category
- C#
- Title
- modificare una strinfa in c#
- Category
- C#
- Title
- how to wait in c#
- Category
- C#
- Title
- c# two dimensional array
- Category
- C#
- Title
- .net core session
- Category
- C#
- Title
- docker ssh
- Category
- C#
- Title
- c# bitmap to Image
- Category
- C#
- Title
- The type or namespace name 'Scrollbar' could not be found
- Category
- C#
- Title
- unity normalize vector2
- Category
- C#
- Title
- toggle unity c#
- Category
- C#
- Title
- native-googlesignin configuration is null!?
- Category
- C#
- Title
- loop over enum values
- Category
- C#
- Title
- razor preview
- Category
- C#
- Title
- c# retrieve files in folder
- Category
- C#
- Title
- 2D follow ia unity 2D with agrorange
- Category
- C#
- Title
- list contains type c#
- Category
- C#
- Title
- c# add to array
- Category
- C#
- Title
- unity get component
- Category
- C#
- Title
- unity hide mouse first person
- Category
- C#
- Title
- winforms c# add data to datagridview with a button
- Category
- C#
- Title
- Globalization and localization in ASP.NET Core
- Category
- C#