Working Out Time Passed Between Two Dates
I am trying to work out the length of time that a page was opened till it reached another page, I amusing the script below Code:
View RepliesI am trying to work out the length of time that a page was opened till it reached another page, I amusing the script below Code:
View RepliesI'm using ASP to access an MS Access database. One issue that I'm constantly
having problems with is Date/Time records.
What I'd like to know is how does one work with date variables in ASP?
My current problem is this...
I have two variables, Mnth and Yr, which each hold an integer. Mnth holds
between 1 and 12 ( a month ), and Yr holds the desired year (2005 for
example).
With only these two variables how can I generate a full date to use in an
SQL query, such as:
SELECT * From Table WHERE DateAdded>??<date value here>??
I'm trying to work out a recurring date by asking the user to select the new date by selecting an option of: First, Second, Third, Fourth or Last week of the month.
What I already know is the specific date which I need to add the new dates to.
My dilema is that I don't know how to work out First, Second, Third..etc. I'm thinking that when I work out the first part I will just need to use the DateAdd function, but in this case I'm not sure about that either.
i want to calculate the total time between to dates and time.
Example: Total time elapsed from date 1 time 1 to date 2 time 2.
27/09/2004 11:00 - 28/09/2004 10:30
The user enters a record and then later comes back and closes it. I need to know the time it took from when they entered the record until the time it was closed.
I am trying to impliment a feature in an ASP webpage that will basically count the number of days between when a projects specific start date is entered and when it is completed (completion date) I want my page to show how many days the project took to complete. Is there an easy way of doing this ? I am using an ACCESS database .
View Replies View RelatedI'm pulling a time value in the format "24HH:MM:SS" into a variable "Time1" but I neeed to create two offsets to that time as other variables. One three hours previous to "Time1" and one that is one hour after "Time1". Is there an easy way to add/subtract times to generate these other variables? I've worked a little with datediff, but never with manipulating times as such.
View Replies View RelatedI'm having trouble working out the best way of calculating the time difference between two times on the same day. The example I have found des return the hours (in this case 8) but forgets the minutes. I am looking to return the hour & the minute but i've had a look at the dateDiff format and this doesn't seem possible ?
---------------------------------
time1 = "09:15"
time2 = "17:30"
hours = datediff("h",time1,time2) ' in hours
response.write(hours)
----------------------------------
I need some code to work out 7 days from the current date. I can hard code it but thought i would ask in here to see if someone has some code already.
View Replies View Relatedwhen guarding against sql injection attack from modified form or
querystring variables is it enough to strip out just apostrophes...if the
variable USERNAME is the name of a text box passed to a script is the below
always safe...
q1="select * from TABLENAME where username='" &
trim(replace(request("USERNAME"),"'","''")) & "'"
I've never seen this before. I am new to querystrings, as just using hidden
fields and the POST method has been more than adequate for me until
recently. But I started using the GET method, and I noticed that when I
clicked the submit button, it gave me this for a URL:
http://localhost/DisplayTickets.ASP...nsearchTSE.y=11
The thing is, selectTSE and Status are the two <SELECT> boxes, so I
understand them being there. But why is is telling me the x and y
coordinates of where I clicked the button to submit the form?
I should add that the submit button is an image, not a regular button.
This doesn't hurt anything, just wondering why it's there. And maybe it will
hurt something later on; I don't know enough to say.
can cookies be passed from a pop up "secure folder log in" window, provided by my hosting company? As I would like to display a welcome message with their name when they log in.
View Replies View Relatedwhen i try passing a numeric value as a string("0004") using asp to a stored procedure, the value is stored as 4 and not as 0004 in the table. In the table and stored procedure the value type is nvarchar.
View Replies View RelatedI have a page that passes a variable in to an sql query
It parses the string (a date) for month and year.
It works when i use the date() function Code:
I'm trying to pass paramter values to another .aspx page via a querystring. The record in the db table looks something like this lahlahlah. The value that gets passed looks like this lahblahblah. So basically the is not getting passed.
Here's what my querystring looks like: Code:
i need to add a variable brought into the
script like: script.asp?variable=var
and i need to make it for use in
var1 = request.querystring("var")
mySQL = "SELECT * FROM members WHERE nick = 'VAR1'"
can anyone tell me how to do this?
When i submit this form all the record values are being passed to the next asp page. But i want only those records which the user has changed in this page.
View Replies View RelatedI am using SQL SERVER 2005 and ASP.
Would anyone be kind enough to give me a solution to the problem below please?
If for example in the stored procedure looks like this:
-- Initialize the SQL Server XML stored procedures
EXEC sp_xml_preparedocument @xmlDoc OUTPUT, @xmlString
Insert into @TableBook
SELECT * FROM OPENXML (@xmlDoc, 'books/book') WITH
(
bookNameVARCHAR(100) 'name',
authorVARCHAR(100) 'author'
)
The question is supposing there is a node called 'Surname' but I am not adding 'Surname' to 'Author'. If I want to check 'Surname' value DOES exists and I want to replace it with 'Author' or if 'Surname' does not exist, just use 'Author' node instead.
I am not sure how you can use IF statement to check a node and put the value into SET @surname and then put something like author VARCHAR(100) '@surname' OR author VARCHAR(100) '@Author'. Just like switching it around.
I would like to clean up my mailing list by changing the URL I use at the moment which is in the format
www.mysite.com/view_pic.asp?pic_number=123
To be
http://www.mysite.com/view_pic.asp?p...il=bob@bob.com
it would then insert the email into a table, collect these for a while and only see these as active members.Any ideas how to do this, I've tried a few things but no luck.
does anyone know why my session number doesnt stay the same when i pressed refresh?
it works on w2k, but not on w2k server
my programmer thinks that the IIS is not passing the session back to the client. is there a way to check or any other alternative for sessions?
I am creatiung a track record website which displays a list of branches and how many people are available at each individual time slot.
I thought the best way to update would be to create a link which passed two variables, the branch and what time slot. This would then be retrieved int he book.asp page which then would knock one of the current count. I came up with the below page: Code:
my ASP code creates a form and an array of chekbox with this statement response.write "<input type='checkbox' name='chkProduct" & Cstr(counter) & "' value='delete'>" all goes well and i also have a button that points to a VBScript function passing one parameter the counter start value so i can loop throught the checkboxs on the client side and determine if checked or not.
Ok i can display my command "document.frmProductCart.chkProduct & (Cstr(counter)) & .checked" as a string in alert but cannot make it as a command like it should be, anyone got any pointers ?
I have created a database connection function which I use to open my database connection and recordset and another to close it. Easy stuff I know. The problem is this.
I want to be able to create database conenctions and recordsets specifically when I call the function. For example Code:
I have a ton of TD attributes that have to be changed based on the
data in the DB. All TD elements are ID and runat=server.
Changing the attributes of a SINGLE TD is simple:
<td id=thisTD runat=server>
thisTD.Attributes.Clear();
thisTD.Attributes.Add("Class",reader["thisTD_Class"].toString());
Now, say we have 100 TD elements with IDs TD_1 to TD_100
I have not been able to find a way to (essentially) say:
for(int i=0;i<100;i++){
"TD_"+i.Attributes.Clear();
"TD_"+i.Attributes.Add("Class",reader["TDClass"+i].toString());
}
in J-Script, I could do it by Eval() or about eight ways through the
DOM. It seems crazy to me that if I can access the Attributes of a
specific element directly by ID (thisTD.Attributes), I couldn't also
access it by reference.
But I have been able to find NOTHING to indicate how this may be done.
Obviously, my problem is not limited to a single attribute, or else I
would have just typed them all out by now. Trouble is, there is a lot
of logic that must be applied to the data before setting the
attribute. Without being able to iterate or loop by reference, I will
be typing for ages just to change some freaking classes.
I have encountered some strange behaviour when using the XMLHTTP Request object in Javascript to return xml from a C# Webservice Method. I create a SOAP envelope and send it off to the Webservice, which I have debug points in, which when hit I can see that all the parameters are coming thru as null....
View Replies View RelatedI would like to display the difference between the logging time
[Session("start"] and the current time [now]. In hours minutes and seconds,
I have tried a couple of things but all I see is gobbledy gook.
I have a website that I subscribe to that allows me to track tasks. I have an extra computer with a big monitor that i want to always display the task list. the problem is after so many hours I get logged out.
I need to need to reload that sign in url every few hours Code:
there i was just windering how do i compare a date/time vlaue in sql server agaisnt the computers' date/time.
for example, if computer date/time is two months or 2 weeks before the database date/time do something
Currently working on a ASP for a friend, which requires the date and
time on it. It pulls in entries from an Access Database with dates and
times in the format of:
"Fri Oct 17 18:02:46 2003"
However my date and time on the ASP page is displayed as:
"Friday, October 17, 2003 18:02:46"
using the script:
"<%Session.LCID = 1033%>
<%=FormatDateTime(Date(), vbLongDate)%>
<%Session.LCID = 2057%>
<%=time()%>"
Anyone know how to change this script, fully or partly to produce the
date and time on the format that's in the access database i.e. "Fri Oct 17
18:02:46 2003" Code:
I am working on a database that collects information about incidents. One of the fields that people enter is the time of the incident. I am trying to convert that string that people enter into a OdbcType.Time and I am at a lost.
View Replies View RelatedHow will we convert the system date & time to other timezone for eg: Eastern Time zone using ASP?
View Replies View RelatedWhen the Form is submitted I use the Date() and Time() functions to put the date and time into the Body part of the e-mail. The time reported is three hours earlier than the time at which the Form is actually submitted.
I understand these functions are evaluated on the server so the server must be in a time zone three hours earlier than where I am . Is there any way I can get the local time at the location where the user is actually located. ?
Any some tools or sample codes drop down asp script execute time and
database connection time ?
I'm trying to do a very simple code that converts the server time into a time zone of your choice.
<%
dim h 'Current Hour
dim i ' Time Zone Increase - add or subtract hours
dim r 'Result Here
h = Hour(Now)
i = + 2
r = h + i
%>
but obvisouly i'm having trouble with the time zone convert.