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
End_Of_Call = formatdatetime(now(), 0)
'work out the duration of the call
duration = End_Of_Call - cdate(vTime)
response.write isdate(End_Of_Call)
response.write isdate(vTime)
'response.write duration
response.End()
but it errors and i get
Microsoft VBScript runtime (0x800A000D)
Type mismatch: '[string: "7/21/2004 2:34:49 PM"]'
/testing/process_new.asp, line 30
I cant understand why it doesn't work, it is being run on the same server as
before and is identical code, except i dont use formatdatetime on both
variables to set them, if i remove formatdatetime i still get type mismatch,
any ideas how i can make this work. thanks 3 1802
all i get when i dont get that error is something like so
3.00925930787344E-04
when i use duration = now() + 10 - now() - get 10
cant understand why it doesn't do it, really annoying as this way used to
work
"Steven Scaife" <nospam> wrote in message
news:#M*************@TK2MSFTNGP10.phx.gbl... 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
End_Of_Call = formatdatetime(now(), 0)
'work out the duration of the call duration = End_Of_Call - cdate(vTime) response.write isdate(End_Of_Call) response.write isdate(vTime) 'response.write duration response.End()
but it errors and i get
Microsoft VBScript runtime (0x800A000D) Type mismatch: '[string: "7/21/2004 2:34:49 PM"]' /testing/process_new.asp, line 30
I cant understand why it doesn't work, it is being run on the same server
as before and is identical code, except i dont use formatdatetime on both variables to set them, if i remove formatdatetime i still get type
mismatch, any ideas how i can make this work. thanks
Use the DateDiff function:
<quote>
Returns the number of intervals between two dates.
DateDiff(interval, date1, date2 [,firstdayofweek[, firstweekofyear]])
</quote>
'work out the duration of the call
duration = DateDiff("s", Now, vTime)
response.write duration
response.End
That will tell you how many seconds have passed. For more info on the
DateDiff function, see your WSH documentation that you downloaded and
installed from http://www.microsoft.com/downloads/d...6-1C4099D7BBB9
Ray at work
"Steven Scaife" <nospam> wrote in message
news:%2***************@TK2MSFTNGP10.phx.gbl... 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
End_Of_Call = formatdatetime(now(), 0)
'work out the duration of the call duration = End_Of_Call - cdate(vTime) response.write isdate(End_Of_Call) response.write isdate(vTime) 'response.write duration response.End()
but it errors and i get
Microsoft VBScript runtime (0x800A000D) Type mismatch: '[string: "7/21/2004 2:34:49 PM"]' /testing/process_new.asp, line 30
I cant understand why it doesn't work, it is being run on the same server as before and is identical code, except i dont use formatdatetime on both variables to set them, if i remove formatdatetime i still get type mismatch, any ideas how i can make this work. thanks
Why are you using subtraction? Do you even know what the default unit is
for date/time-based math? Why don't you use datediff instead of confusing
things with this shorthand?
-- http://www.aspfaq.com/
(Reverse address to reply.)
"Steven Scaife" <nospam> wrote in message
news:#M*************@TK2MSFTNGP10.phx.gbl... 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
End_Of_Call = formatdatetime(now(), 0)
'work out the duration of the call duration = End_Of_Call - cdate(vTime) response.write isdate(End_Of_Call) response.write isdate(vTime) 'response.write duration response.End()
but it errors and i get
Microsoft VBScript runtime (0x800A000D) Type mismatch: '[string: "7/21/2004 2:34:49 PM"]' /testing/process_new.asp, line 30
I cant understand why it doesn't work, it is being run on the same server
as before and is identical code, except i dont use formatdatetime on both variables to set them, if i remove formatdatetime i still get type
mismatch, any ideas how i can make this work. thanks
This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Stinky Pete |
last post by:
I've got a form that has been quite happily useing a pop up calendar to
enter dates. However I've had to amend the world and add the form as a
subform. To my frustration, the pop up calendar now...
|
by: Marc Pelletier |
last post by:
Hello,
I am writing an application that does some simple astronomical
calculations. One of the variables I need is the number of hours passed in
this year. I've written the following function
...
|
by: |
last post by:
Hello,
I am hoping someone else has thought about a date time calculation i need to
perform.
I would like to be able to calculate the number of "working minutes" between
2 dates, given my...
|
by: maflatoun |
last post by:
Hi,
I have the following function to convert UTC time to Local time. It
works perfect for GMT- (Minus) time zones however it provides incorrect
results for GMT+(Plus) time zones?
// Format to...
|
by: Satish Itty |
last post by:
Hi all,
I have a big problem in my hands and not sure how I can fix this. Any
suggestions would be greatly appreciated.
I have a .NET 3 tier app developed in VS2003 and .NET 1.1. the client is a...
|
by: Mikhail Kovalev |
last post by:
opens a new window window_1 which contains a form, uses window
reference to change values there and submits, anyone can have a quick
glimse over this
windows opens ok, nothing happens afterwards :...
|
by: Jeremy Sanders |
last post by:
Hi - I need to add support to a program for dates and times. The built-in
Python library seems to be okay for many purposes, but what I would like
would be Unix epoch style times (seconds relative...
|
by: WebCM |
last post by:
There is a function: http://paste.ubuntu.com/21865
It needs GMT date in YYYY-MM-DD HH:MM:SS format - in SQL: datetime. If date is the same as today, the function returns "Today". There
is one...
|
by: Mike Copeland |
last post by:
I am working with a file of data that contains "time values" (e.g.
"1225365563"), and I want to convert this data into something I can use
in a program I'm developing. From what I've read about...
|
by: taylorcarr |
last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: aa123db |
last post by:
Variable and constants
Use var or let for variables and const fror constants.
Var foo ='bar';
Let foo ='bar';const baz ='bar';
Functions
function $name$ ($parameters$) {
}
...
|
by: ryjfgjl |
last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers,...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
| |