.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

Genarate Dates

Posted By:      Posted Date: September 29, 2010    Points: 0   Category :ASP.Net

Hi , all

Scenario as follows : a person selects a startdate with calendarextendat  ,and  and end date with calendar extendar .

startdate is 20 sep 2010, enddate is 25 sep 2010

now i need to genarate

the dates between start and end date

so the ouput will be

20 sep 2010,21 sep 2010,22 sep 2010,23 sep 2010,24 sep 2010 ,25 sep 2010

Thanks for your help

View Complete Post

More Related Resource Links

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.

Get Dates from Sunday thru Saturday


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?

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        

trouble getting dates right when importing Access table

I was given a bunch of data in Access and am putting it in SQL 2005 for an ASP.NET web app. Tryingto do a query to select only records where the current date is after the "postDate" field and on or before the "expireDate" field. WHERE (postDate <= CURRENT_TIMESTAMP) AND (expireDate >= CURRENT_TIMESTAMP) I'm getting no records returned even though there are some records that qualify. Tried using CURDATE() and NOW(), no difference. At this point I think it may be because the dates are not in the correct format. The columns were originally "Date/Time" format in Access and when I imported them into SQL using the DTSWizard, the datatype for those columns became "smalldatetime." Dates are in the format M/DD/YYYY HH:MM:SS. I'm guessing the query won't work because SQL is expecting YYYY-MM-DD. How do I fix this? Been spending a depressing amount of time running in circles with this.

Help in Building Fiscal Dates Table

hi Experts,  I'm trying to build fiscal periods table. I have Calendar Dates of year 2007  in 1 table and just start Dates of Fiscal weeks in another table, can any one suggest me about building Fiscal table containing entire year using the 2 tables.  thank you ....   

checking dates

i'm currently developing a room booking system for college. the problem i had now is to check the selected date against the dates in a table called HOLIDAY. what i have in the HOLIDAY table included: start_date, end_date & event. i'm not using the default system date format as the user require the date to be in dd/mm/yyyy format. so what i did is the conversion which i take in each day, month and year separately and store under different variables. now, what i'm facing is that i cant get the system to check the date accordingly. i need to come out with a formula to cater for the checking of selected date against the start and end date of the holiday. if the selected date doesn't fall under the holiday, i will display the rooms availability to the user. else, error message will be prompt out. is there any suggestion on the formula i can use? what i have is:if (strSelectedDate.Equals(strHolidayStart) == true) { ** error ** } else { if (strSelectedDate.Equals(strHolidayEnd) == true) { ** error ** } else { if (intSelectedYear == intHolidayStartYear && intSelectedYear == intHolidayEndYear) { if (intSelectedMonth == intHolidayStartMonth && intSelectedMonth == intHolidayEndMonth) { if (intSelectedDay > intH
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