.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
Gaurav Pal
Post New Web Links

find number of sundays between two dates using sql

Posted By:      Posted Date: September 13, 2010    Points: 0   Category :ASP.Net
can i find total number of sundays between two dates using sql? or total number of days between two days except sundays

View Complete Post

More Related Resource Links

Find week number in xpath from two dates in SharePoint 2010



I am trying to determine the week of the year from two dates. The first date will be the first day and month of that year (e.g. 01/01/2005) and the second will be the date of a document(05/05/2005). We tried to accomplish this same task within SharePoint, not using the SP Designer, however, we could not because we could not utilize the name column. Anyhow below is what I got so far. I search for a date function to perform subtraction but could not find any. Thank in advance.


ddwrt:FormatDate(substring($thisNode/@FileLeafRef.Name,1,10),1041,1) -ddwrt:FormatDate(concat(substring($thisNode/@FileLeafRef.Name,1,4),'-01-01'),1041,1)

Need function to find difference between two dates


Hi all

I need a function written in vb to find the exact month difference between two dates.

For example

    Start Date : 01/01/2010

    End Date   : 15/02/2010

 then the difference value should be like this 1.5  i.e i need the difference in decimal value.

I need an expert sql server, number of working day during two dates.

Hi, I've this table below, And I need to calculate between two dates, the number of working day. This table is like that I can't change it. So mondayamid for monday morning mondaypmid for monday afternoon and so on... Thus fields contain the id of the type of day, 1 for working day, 2 for holiday, 3 for sick. And there is the number of the week on a year. Please I've no idea how to calculate the number of workday or half day between two dates. THANKS SO MUCH SELECT       [OwnerId]       ,[mondayamid]       ,[mondaypmid]       ,[tuesdayamid]       ,[tuesdaypmid]       ,[wednesdayamid]       ,[wednesdaypmid]       ,[thursdayamid]       ,[thursdaypmid]       ,[fridayamid]       ,[fridaypmid]       ,[saturdayamid]       ,[saturdaypmid]       ,[sundayamid]       ,[sundaypmid]       ,[weekid]       ,[Notesid]   FROM attendanceentry where owneridname like '%Julimian%' So every half of day, I've the id of the type of the day that people took. 1 - working 2

How can I calculate the Number of Weekends between two dates

I need to be able to figure out the number of Saturdays and the number of Sundays between two dates.  I know that I can do this by looping through the series of dates between the start date and end date.  Years ago I saw a piece of code that an ex-co worker wrote that accomplished this task using a formula.  The formula was extemely effecient.  Unfortunately I no longer have access to this code.  Does anyone have an algorithm that will perform this calculation that I can make use of?  Thanks

How to find the Number of Tables Present in an XML File?

Dear All,Can any one let me know "How to find the number of Tables present in a XML Schema File"?Thanks and Regards,G.V.N.Sandeep

Find missing dates


Hi I   find days missing between dates for expamle. 10 may 2010 , 11 may 2010, 13 may 2010 , with this code

                List<DateTime> dateTimes = new List<DateTime>();

                foreach (String sDate in s)
                    dateTimes.Add(DateTime.ParseExact(sDate.ToString(), format, CultureInfo.InvariantCulture));

                //Check for missing dates thats will indicate an Overlap Booking

                for (int i = 1; i < dateTimes.Count; i++)
                    if ((dateTimes[i] - dateTimes[i - 1]).TotalDays != 1)
                        DateTime start = DateTime.Parse(txtStart.Text);
                        DateTime end = DateTime.Parse(lblEnd.Text);

                        ConstructTable(start, end);
                        //btnBook1.Visible = true;
                        lblError.Text = "Bookings May Not Overlap";

then this shows an error  lblError.Text = "Bookings May Not Overlap";

But now say i have got a textbox with these dates in it , wich i have

19 September 2010,20 September 2010,21 September 2010,22 September 2010,23 September 2010,19 September 2010,<

How can I calculate the Number of days between two dates Monday to Friday


    I am using following code for Robert's Posted Code (Url:http://forums.asp.net/t/1142378.aspx) But this is for only calculate weekends saturday and sunday can any one tell me how 
I get Number of days between given two dates Monday to Friday.

private const int MONDAY = 1; private const int TUESDAY = 2; private const int WEDNESDAY = 3; private const int THURSDAY = 4; private const int FRIDAY = 5; private const int SATURDAY = 6; private const int SUNDAY = 7; /// <summary> /// Observe that the method calculates by including the start day, but excludes the end day /// </summary> /// <param name="startDate"></param> /// <param name="endDate"></param> /// <returns></returns> private void GetWeekendDaysBetween(DateTime startDate, DateTime endDate,out int saturdays,out int sundays) { saturdays = -1; sundays = -1; if (endDate < startDate) return; TimeSpan timeBetween = endDate.Subtract(startDate); int weekendsBetween = timeBetween.Days / 7; sundays =

How to find the Sum of a definite number of elements in a hierarchy in a cube



I guess my Query is pretty simple, but I am very new to MDX so having a problem in formulating the same. I need to find out the top 10 members in my hierarchy on basis of a measure and then need to sum all the others in the Hierarchy as "All Others". To explain it in a bit of detail, Suppose I have a Geography Hierarchy containing Cities A, B,C...till Z. Now I want the population (measure) of the top 10 cities and in the 11th position I want the sum of all the rest cities (which are not counted in the top 10) for two years say 2010 and 2009 and then want the absolute difference of that as well. The result set should look like,


Pass index number and find the char in a string?


How do i find the charactors in teh first index and the last index number of a string? 


How to find number of documents uploaded to each sharepoint site?


How can I determine how many documents are uploaded to each sharepoint site?

How to create a calculation in a list - Calculate the number of days between two dates


I have a calculated column in a list called Days Open. This column contains the number of days between today (Sysdate) and another column called the Effective Date. Therefore, if Sysdate is 11/16/2010 and the Effective Date is 10/14/2010, how do I calculate the number of days between the two dates?

I tried using this formula: =TEXT(Sysdate-[Effective Date],"h") and then I tried =INT(Sysdate-Effective Date) & TEXT(Sysdate-Effective Date, ":hh:mm")

Neither formula worked. I hope it is something real simple that I am missing here. Any help you can provide will be highly appreciated!

Convert English to Arabic number without changing any regional settings in .net

Well, most applications that I worked with was multilingual that supports English UI and Arabic UI.

And one of the major issue that we have faced is displaying Arabic numbers without the need of changing the regional settings of the PC.

So the code below will help you to display Arabic number without changing any regional settings.

dynamically adding sql server columns based on number of files in fileuploader


I want to create a new table to sql database at runtime.  The column names would be "Name", "Date", "Event".  I would also like to have one more column name "Image" but the problem is that since the amount of images will vary, I want the application to count the amount of files in the Multiple fileuploader and then add a image column to the table for the respected amount of files. 

For example if i am uploading 3 files in the multiple fileuploader, the names should be "Name", "Date", "Event", "Image1", "image2", Image3"

I also would like that table name to be name dynamically from the textbox Name when the user enters the information.


I have the following code to make a new table, but I dont know how to name the fields at runtime like previously asked please help!!!


Dim objConn As New SqlConnection("Server=<servername>;uid=<userid>;pwd=<password>;database=master")


Embeb a variable number of videos


I need to provide some alternate content for my non-Flash users.

I have a directory of video files that is scanned using the DirectoryInfo() function, and I want to use the results to embed all files ending in ".mov" in QuickTime players on a web form.

How would you approach this? Right now I am using the count on the array of videos to determine how many times to repeat the embed code.  But this seems inelegant.

Is there a way to have a single QuickTime player.ascx control that gets duplicated according to the number of videos available for display?

Article commenting by line number


I'm wondering what's the best way to approach an online article system that allows users to comment by clicking on the line they are commenting about? Essentially the same way Adobe Acrobat works with comments where you can click anywhere and the text is saved for that location.

I'm assuming a mix of jQuery would be the crux of the interface. The system would need to save comments so that when another user logs in, they will also see the other comments but they can´t edit them - only add their own.

Any suggestions would be great.

find a Control inside a GridView using jQuery


I have databound GridView in my page and I have a hidden DIV in all rows. Each row contains a Button that I want it to make the DIV visible for me! how can I use that with jQuery?!

here is the code page: 

<asp:GridView ID="GridView2" runat="server" AutoGenerateColumns="False" 
                                EnableModelValidation="True" GridLines="None" ShowHeader="False" Width="100%">

The number of members in the conceptual type ... does not match with the number of members on the ob



I've added a scalar property to an entity and now ASP.NET Dynamic Data scaffolding throws this error:

The number of members in the conceptual type 'TrainingModel.Users' does not match with the number of members on the object side type 'TrainingModel.Users'. Make sure the number of members are the same.

This happens at the following line in global.asax:
model.RegisterContext(typeof(TrainingModel.TrainingEntities), new ContextConfiguration() { ScaffoldAllTables = true });

Please help!

ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend