.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

Get Dates from Sunday thru Saturday

Posted By:      Posted Date: August 27, 2010    Points: 0   Category :ASP.Net

I'm using the date picker and I need to know how (or if it's even possible), to select a date, and based on the date, have the actual query use the week the date was in and return all the records from that week (Sunday through Saturday)

Like - if I pick 8/24/2010 - it returns a date range of 8/22 through 8/28
I'd also like to display the date range in the report, somehow

Any ideas on how I do this?

View Complete Post

More Related Resource Links

Remove Saturday and Sunday from Calendar Web Part View MOSS 2007



Is there a way to remove Saturday and Sunday from the default calander web part view.  I need to get my calendar to fit in a 800x600 window, so users do not have to scroll.  I would just like for the calendar to show Monday through Friday.

Find the nearest date before Saturday, Sunday and holidays with Linq


 var tecaji = (from xml in doc.Descendants(slazhnmaespace + "tecajnica")
                      where xml.Attribute("datum").Value == "2010-10-158"
                      select xml).Elements().Where(a => a.Attribute("oznaka").Value.Equals("TRY")).Select(n => n.Value).SingleOrDefault();

I have dates that are not in the XML file, but value still has to show.

In the table there is no value for the date of 23.10.2010, 24.20.2010. How do you show value for the date 10/22/2010?

Finding the appropriate date, which is najbluzjemu to that in the table.

In this XML table is not displayed dates (Saturday - Sunday).

Therefore, to find the nearest date before Saturday and Sunday.

If it is Saturday, the date "02.10.2010" shall be the date of "01/10/2010.

How do I get to that solution?


How do you determine that the last day of the previous month falls on a Saturday or Sunday?


How do you determine that the last day of the previous month falls on a Saturday or Sunday?

I know that this will give me the last day of the previous month




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.

How to increment default dates in the subscription


I have a report that I want run on a monthly subscription, but the report has a default date parameter. Is there a way to have the default date parameter increment each month. So if I choose to receive the subscription monthly I would want that default date to increment.

Date help: I need the Sunday date that corresponds to any date

Hello I need to know the syntax for finding the Sunday Date that relates to any given date. Example, Monday August 23 2010 thru Sunday August 29th 2010 would all have the value of August 29 2010 Thank you -

QUERY filter dates by DAY

i have the following data : first column: dates and 2nd column: values i want to filter the dates per day and calculate the AVERAGE of their values per day i can filter them manually by setting day(datetimefield) = 12 and calculate the AVERGAE but i dont know how to do it for all in one query? each record resulting the average of that day   2010-07-12 00:00:00.000 900 2010-07-12 10:00:00.000 1000 2010-07-12 10:10:00.000 1200 2010-07-12 12:00:00.000 1100 2010-07-12 15:00:00.000 1300 2010-07-12 15:10:00.000 1500 2010-07-13 00:00:00.000 6500 2010-07-13 10:00:00.000 5500 2010-07-14 00:00:00.000 5500 2010-07-14 10:00:00.000 4400 2010-07-15 10:00:00.000 4500 2010-07-16 00:00:00.000 1000 2010-07-17 00:00:00.000 7000 2010-07-18 00:00:00.000 8500 2010-07-19 00:00:00.000 1500 2010-07-20 00:00:00.000 1700 2010-07-21 00:00:00.000 1900 2010-07-22 00:00:00.000 2000  

Hiding other month dates in ASP .Net Calendar Control

Often we need ASP .Net calendar control in our webpages. Most of the times we require navigation in between dates of the calendar control but there can be a requirement that when we want that users should not be able to select dates from month other than the current month.Some people might be thinking in mind that Microsoft has provided theShowNextPrevMonth property of a calendar control which can be set to false in order to disable the navigation in between months. Ok, this will disable navigation but what about the dates of adjacent months shown in current month?Following is the output of a normal Calendar control when ShowNextPrevMonth is not set to false.Note the red circles in above image. July and September will allow you to navigate through other months and red circles below will allow you to select dates of adjacent months.Ok now we set the ShowNextPrevMonth property to false and see the output. Following is the output in this case.So setting out the ShowNextPrevMonth property has disabled the July and Septemberlinks but dates of adjacent months are still there which can be selected as well. How to disable/hide these? Unfortunately there is no such default property provided using which one can disable or hide these dates but fortunately doing this using code is not a complex task. Use following code a

passing dates in stored procedure?

I am trying to pass dates in  a stored procedure and keep getting an error - here is the code and error.  eventually the sproc will be used in SSRS.     ALTER PROC [dbo].[USP_SPROC_X] @DATE DATETIME AS SELECT ITEM , PRICE , SELL_DSCR , PRC_EFF_DT , PRC_END_DT , PROPOSED_BY ,CONFIRMED_BY FROM SALES WHERE @DATE BETWEEN PRC_EFF_DT AND PRC_END_DT   Msg 4104, Level 16, State 1, Procedure [PROCNAME], Line 141 The multi-part identifier "PRC_EFF_DT" could not be bound.

BCS Showing wrong dates

I have created an external content type which connects to a SQL database view so that it is read only.  It is an employee table that contains fullname hiredate and birthdate columns.  From this content type I have also created the external list and added it to the HR site on SharePoint Server 2010. When I connect to the view in SQL, and execute the table, it shows the proper dates.  When I view the list on SharePoint it shows the dates off by one day for both the hire date and birth date columns. I have deleted and recreated the content type using SharePoint Designer 2010 and no change. Any ideas what is happening?

calculate business day between two dates

Hi Guys   I need the count of business days between two  dates Date1, Date2 i need the count only business day (exclude sartuday&sunday) If date1 is null or nothing i need to pass 0 If date2 is null or nothing i need to pass 0   help on this

Calculated measure between two dates

Following fact table - Amount - StartDate - EndDate - SomeOtherDate   If the user selects a date in the time dimension I want to build the sum of Amount where the selected date is between StartDate and EndDate. Like this   SELECT SUM(Amount) WHERE <date> between StartDate and EndDate   Is it possible to create a calculated measure like this.   Thanks.

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 to load dates in a table in a range

Hi i have a table DATEDESC with columns [FullDate] [DateName] [YearName] [MonthName] [DayOfTheWeek] [YearNumber] [MonthNumber] [WeekNumber] [DayNumber] SAMPLE DATA OUTPUT FULL_DATE DATE YEARNAME MONTH_NAME DAY_NAME YEAR MONTH_NUMBER WEEK_WITHIN_THE_MONTH WEEK_WITHIN_THE_YEAR DAY_NUMBER 2010-09-09 24:31.9 2010-09-09 NOT LEAP YEAR September Thursday 2010 9 2 37 9   I need to load a series of dates into this tale by giving a start and and end dates range. Lets say i need to load 10yrs of date's data into this column, i need to load all the dates into this table and get those respective column. The query i had to populate the sample data was with the current date. But i am not sure how to do this for a bunch of data when it is in a range. SELECT GETDATE() AS FULL_DATE, Convert(varchar(10), getdate(),110) as DATE_NAME, CASE (YEAR(GETDATE()))%4 WHEN 0 THEN 'LEAP YEAR'ELSE 'NOT LEAP YEAR' END AS [YEAR_NAME], DATENAME(MONTH,GETDATE()) AS [MONTH_NAME], DATENAME("DW",GETDATE()) AS [DAY_OF_THE_WEEK], DATENAME(YEAR,GETDATE()) AS [YEAR_NUMBER], MONTH(GETDATE()) AS MONTH_NUMBER, DATEPART(DAY,GETDATE() -1)/7+1 AS [WEEK_WITHIN_MONTH], DATENAME("WEEK",GETDATE()) AS [WEEK_WITHIN_YEAR], DAY(GETDATE()) AS  DAY_NUMBER So, could you please help me in build this query. Thank you.

Data View and Scheduled Start & End Dates Filtering

I have a data view that needs to display all pages that are current and the closing date is greater than or equal to today's date. The issue I am having is that the data view is displaying pages that are have the a future scheduled start date or the scheduled end date is past, i.e. something that has a start date of tomorrow, is displaying and a page that has an end date of yesterday is displaying. I can tried to filter the data view on the scheduled start and end dates but I can't see it in the Filter Options of the 'Common Data View Tasks'. I have also tried adding XSLT Filtering but am unsure how to set it up.  I have added the following as an XSLT filtering [@PublishingStartDate<=$Today or string-length(@PublishingStartDate)=0] I am wanting to check whether I have done this correctly or not. Some pages won't have a scheduled start date but all will have an end date. Below is the code from my data view: <WebPartPages:DataFormWebPart runat="server" ShowWithSampleData="False" AllowRemove="True" AllowHide="True" SuppressWebPartChrome="False" PartImageLarge="" ViewContentTypeId="" ExportMode="All" Dir="Default" MissingAssembly="Cannot import this Web Part." ID="g_fdf00570_38e8_4df9_8ab3_5ca3ed974c41" DataSourceID="" IsIncludedFilter=""

find number of sundays between two dates using sql

can i find total number of sundays between two dates using sql? or total number of days between two days except sundays

How do i calculate no of days between two given dates

Dear All, My requirement is used to find no of days between two given dates and time(from date and to date). using c#. Thanx in advance Dinesh        
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