Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

form Value changes as its passed to a variable 1

Status
Not open for further replies.

ItHurtsWhenIThink

Technical User
Sep 1, 2007
60
0
0
US
This has happened to me a couple of times. Not sure why it happens.

Here is what I have

The form value entered is: 1/15/2011. Date doesn't matter. it happens with any date.

when I process the form....

strD=Request.form("var")
now lets spit out the results

response.write(strD) will spit out 1/16/2011
Response.write(Request.form("var")) will spit out 1/15/2011

Hmmmmm.

What the?
who the?
where the?
 
VBScript has only one data type called a Variant. A Variant behaves as a number when you use it in a numeric context and as a string when you use it in a string context.

Beyond the simple numeric or string classifications, a Variant can make further distinctions about the specific nature of numeric information.

These different categories of information that can be contained in a Variant are called subtypes. Most of the time, you can just put the kind of data you want in a Variant, and the Variant behaves in a way that is most appropriate for the data it contains.

But if this does not happen, then you can use conversion functions to convert data from one subtype to another.

VBScript CDate function returns an expression that has been converted to a variant of subtype Date. So, you might try the following:

strD=CDate(Request.form("var"))
response.write(strD)

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top