473,394 Members | 1,759 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

Help!! I can't figure out the correct syntax

Tim
In an ASP web page I am trying to calculate a value in seconds from
two date and times. Can anyone help me find the correct syntax to make
this work?!?!

(This code below work correctly)
DetectionTime=#7/30/03 10:36:45 AM#
MyTime=#7/30/03 10:36:45 PM#
TTClose=(MyTime)-(DetectionTime)
TTTClose=(((TTClose*24)*60)*60)
(This code does not work)
DetectionTime=" # " & RS("DetectionTime") & "# "
MyTime = "#" & FormatDateTime(Now,2) & " " & Time & "#"
TTClose=(MyTime)-(DetectionTime)
TTTClose=(((TTClose*24)*60)*60)

(Error message)
Microsoft VBScript runtime error '800a000d'

Type mismatch: '[string: "#7/31/03 9:41:21 AM#"]'

/mcDevtest/Calculate.asp, line 18
Jul 19 '05 #1
2 2074
You're trying to subtract strings.

There are a few things.

1. You should not need to put the #'s around your RS("DetectionTime")
2. Why are you formatting Now() to strip the time and then concatenating
the time right back to it? You can just use Now() by itself, or use 0 for
the formatdatetime argument if you prefer.
3. Take a look at DateDiff in your WSH documentation, or online at
http://msdn.microsoft.com/library/en...ctdatediff.asp

Ray at work

"Tim" <la**********@yahoo.com> wrote in message
news:71**************************@posting.google.c om...
In an ASP web page I am trying to calculate a value in seconds from
two date and times. Can anyone help me find the correct syntax to make
this work?!?!

(This code below work correctly)
DetectionTime=#7/30/03 10:36:45 AM#
MyTime=#7/30/03 10:36:45 PM#
TTClose=(MyTime)-(DetectionTime)
TTTClose=(((TTClose*24)*60)*60)
(This code does not work)
DetectionTime=" # " & RS("DetectionTime") & "# "
MyTime = "#" & FormatDateTime(Now,2) & " " & Time & "#"
TTClose=(MyTime)-(DetectionTime)
TTTClose=(((TTClose*24)*60)*60)

(Error message)
Microsoft VBScript runtime error '800a000d'

Type mismatch: '[string: "#7/31/03 9:41:21 AM#"]'

/mcDevtest/Calculate.asp, line 18

Jul 19 '05 #2
Tim
Thanks for your help! That is what I needed.
"Ray at <%=sLocation%>" <myfirstname at lane34 dot com> wrote in message news:<OE**************@tk2msftngp13.phx.gbl>...
You're trying to subtract strings.

There are a few things.

1. You should not need to put the #'s around your RS("DetectionTime")
2. Why are you formatting Now() to strip the time and then concatenating
the time right back to it? You can just use Now() by itself, or use 0 for
the formatdatetime argument if you prefer.
3. Take a look at DateDiff in your WSH documentation, or online at
http://msdn.microsoft.com/library/en...ctdatediff.asp

Ray at work

"Tim" <la**********@yahoo.com> wrote in message
news:71**************************@posting.google.c om...
In an ASP web page I am trying to calculate a value in seconds from
two date and times. Can anyone help me find the correct syntax to make
this work?!?!

(This code below work correctly)
DetectionTime=#7/30/03 10:36:45 AM#
MyTime=#7/30/03 10:36:45 PM#
TTClose=(MyTime)-(DetectionTime)
TTTClose=(((TTClose*24)*60)*60)
(This code does not work)
DetectionTime=" # " & RS("DetectionTime") & "# "
MyTime = "#" & FormatDateTime(Now,2) & " " & Time & "#"
TTClose=(MyTime)-(DetectionTime)
TTTClose=(((TTClose*24)*60)*60)

(Error message)
Microsoft VBScript runtime error '800a000d'

Type mismatch: '[string: "#7/31/03 9:41:21 AM#"]'

/mcDevtest/Calculate.asp, line 18

Jul 19 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: Oplec | last post by:
Hi, I am trying to figure out the correct syntax for declaring a friend function in a class template and then defining that member after the class. The code example below is what I am trying to get...
0
by: khawar | last post by:
hi every body i need help i have a dataset called ds, which contains a table called login_table, which contains three columns, namely (login, password, email). Now the question is that, can...
3
by: martinharvey | last post by:
This is probably a very simple question but i would appreciate some help with the correct syntax for and update stored procedure I have created a user form that allows the user to update the...
3
by: Kentor | last post by:
hello, im trying to make a little loop, but i cant figure it out... i have a string with a bunch of 1s and 0s in it: 110101010101111010101 .... i need to count the number of 1s divide it by 2 and...
2
by: gdarian216 | last post by:
I am tring to write a program that will take a string of text input and correct the spacing and capitalization. I have been able to get it to except the string by using getline. I know that the...
0
by: mountainbig | last post by:
I have the following tables with the following Coumns Product -- Partnumber, description, shortcodeid Shortcc -- shortcodeid module -- moduleid, shortcodeid Salesitem -- salesorderid,...
5
by: chevon1920 | last post by:
I am trying to do my assignment but I cant figure out how to get 8 data points per line to print to a file. Here is the assignment 1. Program asks the user to enter an odd number as a BASE,...
6
Soniad
by: Soniad | last post by:
Hello, I am excecuting a stored procedure in my ASP page , it has one out parameter (@confirm) . after executing the procedure i want to retreive this out parameter and assign it to variable...
0
by: Zettai | last post by:
Hi All, I am trying to query a mysql database using the 'LIKE' keyword within my query based on what the user has input. It works if I pass the string, however I am having trouble getting it to...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
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...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
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...
0
Oralloy
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,...
0
jinu1996
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...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.