Sql - Get Days (monday ,tuesday.....) Between Two Different Dates?
Dec 8, 2011
I need to show a report, which will show weekly report for training session.. from Monday to Saturday some time Sunday with the number of participants per day.i want sql query to complete this task.eg.
code days mon tues Wed thurs fri sat sun
10001 3 22 22 22 0 0 0 0
10002 5 10 10 10 10 10 0 0 and so on....
Here no. of participants are same for all days of that training session.
Updated Query
.....................my query as per @competent_tech suggestion .........................
CREATE VIEW SessionDOW
AS
[code].....
here week start from 12th dec and end to 18th dec but training session start from 5th dec and ends at 14th dec but still next few days(15,16,17,18) showing participants value.
I'm trying to get, as the title says, the number of days between 2 dates. TextBox8 is set to a parsed version of the current date. The user has to enter the other date into TextBox7.Then I try to use this function that i made. The code does not work, I get an exception. I have never made a function before so I don't really know much about them. I honestly don't even know if this is possible,
How can I calculate number of days between two dates. For example between 24/12/2009 and 29/12/2009. How can I know that how many days are there between these two dates?
I've been given two dates that takes their values from two respective dtpickers.I've got to calculate the exact amount of days, months and years between them.[code]The problem is that this function gives me ALL the amount of respective days, months and years passed, but I need to split them up in the correct way. Ex, between 28/2/98 and 13/1/2007 the result should be 15 days, 10 months and 8 years. And above all, the result is that the function indicates one month more (or one year more) with only one day (or month) passed between the two dates!
How do I calculate the difference between two dates to display as a number in days?I have 2 text boxes (txtHStart_Date & txtHEnd_Date) I have used an Ajax Calendar Extender to enter the dates in each of these text boxes.I would like to get the difference between these two dates to show in a seperate text box (txtNoOfDays)
I've seen the timespan function but can seem to get this to work. I'm not to sure how to declare the text boxes as the dates I would the calculation to be made from
Code:
Dim D1 As Date Dim D2 As Date Dim ts As New TimeSpan D1 = txtHStart_Date.Text D2 = txtHEnd_Date.Text ts = D2 - D1
But I know this isn't right. I also don't know how to get it to display in the 3rd TextBox.
how to manipulate the dates to determine which date will be 30 days more then the datetime control I have on my form. i need to take the chosen date from the DateTime control, and determine what date it will be in 30 days. Eventually I will use this process to search through the database to print monthly reports.
I try to make a WFA for filling, reading etc. to a database. I want to compare 2 dates (actually 1 date is changed by 42 days) that are chosen by a user through a datetimepicker. After comparing the 2 dates the "newest" date has to show up in a non editable textbox. This Is my code (of course I have 2 subs for the datetimepickers as well).
Private Sub AwbdatumTextBox_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles AwbdatumTextBox.TextChanged Dim DatumbinnenkomstDateTimePicker As DateTime
I need this for 2 different changes.ON one form i got a week calendar, the other a month calendar.Was hoping to add 2 buttons previous & next.To scroll back in time x days, or x days forward.And similar for the months, but instead of days months.Can anybody give me a exaple or a method how to get this to work?Figured it could be done with a loop, but not sure anymore.
The function for getting the difference in days between two days is giving me a wrong answer here.What could i be doing wrong??? DateDiff(DateInterval.Day, CDate("28/1/2011"), CDate("31/1/2011"))
I have a DateTime struct I use, and sombody commented out the part where it was created (but not declared) When I was using it, myDate.DayOfWeek == DayOfWeek.Monday returned true.
If the part where it is created is commented out, how can it tell me it's monday, instead of throwing some exception?
I need to find the date of Monday this week programmatically.For example, for this week Monday was on the 9th, so the date I need is: 09/11/2009.And when we roll over to next week it needs to calculate: 16/11/2009..I have tried doing this myself but I can't see how to do the arithmetic.
I have a date in the future e.g. 13/10/2008 I need to subtract the current date (today is the 28/09/2010) minus 7 days, so thats 21/09/2010 minus 13/10/2008, which would equal erm, 720 something ? But the current date won't always be 28/09/2010, obviously. I need the code for this. EDIT: When i said future I mean past :)
I have a two buttons: Previous Week & Next Week When i run the app the LabelDate needs to shows up "May 31, 2010 - June 6, 2010" When i click a previous week button i want to set LabelDate's text to "May 24, 2010 - May 30, 2010" If i click Next Week button i want it shows up "June 7, 2010 - June 13, 2010" Means it should always display previous/next week starting from Monday and ending with Sunday.
I'm using two datetimepicker controls to set the start and end dates for a range of dates I'm searching for.I want to make sure that the start date selected is not greater than the end date. This code works, but it runs the messagebox prompt twice for some reason. I've tried to ignore it from doing this, but it's not working. Can someone tell me what's wrong?
Private Sub dtpStart_ValueChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles dtpStart.ValueChanged
I have one more problem with MonthControl.And when I bold some dates the program doesn't show bold dates on month calendar.When I move on next or previous month and get back to currently month the program normal displays bold dates. What's the problem?
l = SQLDataSet4.Tables(0).Rows(j).ItemArray(1).ToString
Dim SQLStatement6 As String = "UPDATE `scheduler`.`teacher_report` SET `'" & l & "'` = 'Not Available' where `teacher's name` = '" & SQLDataSet5.Tables(0).Rows(k).ItemArray(1).ToString & "' and time = '" & SQLDataSet5.Tables(0).Rows(k).ItemArray(2).ToString & "' "
unknown column monday in the field list which refers to l but if i type on monday it is okay..