I am wanting to retrieve the current date and submit to db in DDMMYYYY format. I have got it working but am now worried that if the month was January, that the value returned would be 2812003 and not 28012003.
Can anyone confirm that the below code will return 01(January) etc for the month instead of 1?
I m having two combobox on my page cmbyear(years) and cmbmon(months). i want to make a check that if year selected is current year then selected month should not be greater than current month. how we can achieve this.
one way out is that we can store values of selected options in two variables in javascript function. In the function we can make the check that if selected value for year is current year and selected value for month is greater than current month then it ll show some error message and reload the page.
i m trying this but do not get results. May be i m having some mistake in syntax. can anyone tell me how to get selected value in a variable in javascript or some other way out to achieve this. I have applied same technique on text box value. its working fine. but with combobox. i dont know whats the prob.
If I keep a hard sql statment to show all records from 1 to 31 of each month will get error on months where there are no 31 days, how can i know the last day of the month ? any sql function or just via programming language? Using ASP and Sql Server 2005!
I have the following for the header in my table which should display "November", "December", "January" but instead I'm getting "November", "January", "December". Is it possible to do it like below or will I need to incorporate year in some way to that when it gets to these last months in a year it will know start back at January? Code:
<% DIM iMonth iMonth = Month(now) For x = 1 to 3 intMonth = Month(iMonth) Response.Write("<td align=center colwidth=""50""><b>" & MonthName(iMonth) & "</b></td>") iMonth = Month(iMonth)
I need writing a SQL select statement. I know this one has to be simple, but I can't seem to get the query right. I need one query to select where the date range falls within the last 24 months, and a second query for data that's older.
I am trying to get my SQL Query to to through a list of faults, and pull all the records from the previous month (say now is july(7) it pulls all from june (6)
the current SQL i have is....
SELECT Faults.DateAdded, Faults.[Teacher ID], Faults.[Computer ID], Faults.[Type of Fault], Faults.[Description of Fault], Faults.Fixed FROM Faults WHERE ((Month([DateAdded])=Month([Date])-1));
I have an Access "date/time" column and I am trying to use SQL to select by month. I thought the code below would work (to query for records in april for example) but I am still getting all the records regardless of when the date is.
SELECT * FROM comm WHERE comm_requested_date = month(4)
Basically, I have a drop menu with the months and I want to query the DB for all records for a particular month.
Does anyone know of a formula that I can use to work out the number of days in a month not including the weekends?
I know I could probably use a loop that checks each day and if it is a weekday it adds to a counter but I'm guessing that would make things run a tad slower and the way this system is running I wouldn't want to make it any slower.
If I would like to get the week number for month, let's say today is July 25, 2005, which is the fourth weeks for July, how can I use base on the date I have and convert to get the week number in ASP.
I know the ASP/VBScript function for retrieving the current month - the Month() function. But how do i use this in a query to retrieve all records pertaining to a month?
For instance, my SQL Server table has a date field (TestDate) which stores the date when a test was taken by a person. How do I write a query that would pull all the records for tests taken this month?
Likewise, how would i pull for a week? I can't do a Date() - 7 because it has to be each work week..
as you read, i have a script that needs to execute on last day of month, is there a way that i can automatically get this script to execute itself on the last day of every month?
i kno i could scedule a task on the server, but you have to select a day of every month, so then the latest it could be would be the 27th.
I am trying to build a commission calculator for my sales team. Commissions are calculated every month. What is the syntax to pull all records from the previous month?
In other words, at the beginning of December commissions will be paid on November sales so I need to pull all sales recorded in November.
I found this code to pull the current month:
month(now())
so I added a -1 at the end for this
month(now())-1
I haven't tested it yet as I still have many things to do before I can upload to the server to test it. Is that the correct syntax? If not, what is? Also, how can I get the month AND the year?
This will be a default value of the Date field, so I need it in asp, not SQL.
What would be the best way to convert a month number to its corresponding string? I.e, 3 -> 'March'.
Can I do this without using an array? I have a search function and the values of my months are in numbers so that they can be ordered correctly, but I need them to be displayed using their names, not numbers.
I have a field in an access db which is of the data type Date/Time holding a date in the format, Short Date. Thefore it looks like 10/03/2004. The table holds a lists of events and I want to list them all by month breaking on the month as a header (and only listing for months which have events), like so:
I need know the week nuber of the month. I know the function datepart() but returns the week number of the year a number between (1,53) I need a number between (1,4 o5). There is a function or method that i can use to do it?
I keep getting an error at the line in bold. It says some crap about "Type incompatible" and wont even print out the next line. What the hell is wrong with my code?