473,770 Members | 7,287 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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=(((TTC lose*24)*60)*60 )
(This code does not work)
DetectionTime=" # " & RS("DetectionTi me") & "# "
MyTime = "#" & FormatDateTime( Now,2) & " " & Time & "#"
TTClose=(MyTime )-(DetectionTime)
TTTClose=(((TTC lose*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 2089
You're trying to subtract strings.

There are a few things.

1. You should not need to put the #'s around your RS("DetectionTi me")
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**********@y ahoo.com> wrote in message
news:71******** *************** ***@posting.goo gle.com...
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=(((TTC lose*24)*60)*60 )
(This code does not work)
DetectionTime=" # " & RS("DetectionTi me") & "# "
MyTime = "#" & FormatDateTime( Now,2) & " " & Time & "#"
TTClose=(MyTime )-(DetectionTime)
TTTClose=(((TTC lose*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******* *******@tk2msft ngp13.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("DetectionTi me")
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**********@y ahoo.com> wrote in message
news:71******** *************** ***@posting.goo gle.com...
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=(((TTC lose*24)*60)*60 )
(This code does not work)
DetectionTime=" # " & RS("DetectionTi me") & "# "
MyTime = "#" & FormatDateTime( Now,2) & " " & Time & "#"
TTClose=(MyTime )-(DetectionTime)
TTTClose=(((TTC lose*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
8960
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 to work properly; it generates a link error. Thank you, Oplec. #include <cstdlib>
0
2310
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 someone translate this query in correct syntax of C#: "select email from login_table where login='john'" i want some thing like following, and i don't know the
3
1579
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 name and address fields in a datatable called customers based on the input value customer ID = ( datatable/Customers)customerID I have got this far and then got lost: Create SP_UpdateCustomer
3
1809
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 make a table with 2 columns and then for every one, depending on its position in the string i need to output a word and then go to the next 1 and output a dif word.... its amenities, winter activities and summer activities for cottages that i...
2
1543
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 easest way to do it would be to make everything lowercase then make loop to look for whitespace and make sure there is only one space between words, commas, and periods. I then would need another loop to make every letter after a period capital and the...
0
886
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, accountid, Partnumber, saleslineid configuration -- moduleid, accountid I am looking for the following colums back
5
1879
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, using this Base it creates 48 multiples of the BASE and prints in a data file "data_3b.txt", 8-data per line. 2. Program opens this data file, scans the contents of "data_3b.txt" file and counts all the odd data, and prints them on the screen: 4 data...
6
7283
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 (confirmation) declared in page. Dim RsSp , SQLSp Set RsSp = Server.CreateObject("ADODB.Recordset") SQLSp = "Declare @confirm varchar(1)" SQLSp = SQLSp & "Exec SendMsg_proc "& "'" & UniCode &"' , '" & DintUserId &"' , '" & DintOrg_id &"' ,...
0
2258
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 expand the parameter when combining it with the LIKE MySQL keyword. As seen below parameters work in a simple SELECT without 'LIKE': string sql2 = "SELECT * FROM vocab WHERE english LIKE '%" + english + "%'"; string sql3 = "SELECT * FROM...
0
9425
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10230
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10058
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
9870
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8886
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7416
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6678
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5450
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
3
2817
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.