473,414 Members | 1,964 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,414 software developers and data experts.

Different results if you have String or a Varient for Dates?

I have the following page as test.aspx:
************************************************** *
<html>
<head>
<title>Hello and Welcome Page</title>
</head>
<body>
<center>
<%
Dim CurrentDate As String
CurrentDate = Today
%>
The current date is <%=CurrentDate %>.<br>
</center>
</body>
</html>
************************************************** *

If I have CurrentDate as String, like I do here, I get the following
page displayed:

The current date is 2/14/2004.

But if I take out the As String and have only "Dim CurrentDate", I get
the following result:

The current date is 2/14/2004 12:00:00 AM.

Why do I get the time for the Variant and not for the string? Why we
get different results, depending whether the resulting variable is a
String or Variant. I am assuming that the time is being truncated for
the String and not for the Variant. Why?

Thanks,

Tom.

Nov 20 '05 #1
5 1054
Cor
Hi Tom,

This is a VB.net newsgroup.

I do not know if you get an answer here, but you get probably a better
answer in an ASP newsgroup.

You can try it in the newsgroup

microsoft.public.dotnet.framework.aspnet.

I hope you find your answer,

Cor

"Thomas Scheiderich" <tf*@deltanet.com> schreef in bericht
news:40**************@deltanet.com...
I have the following page as test.aspx:
************************************************** *
<html>
<head>
<title>Hello and Welcome Page</title>
</head>
<body>
<center>
<%
Dim CurrentDate As String
CurrentDate = Today
%>
The current date is <%=CurrentDate %>.<br>
</center>
</body>
</html>
************************************************** *

If I have CurrentDate as String, like I do here, I get the following
page displayed:

The current date is 2/14/2004.

But if I take out the As String and have only "Dim CurrentDate", I get
the following result:

The current date is 2/14/2004 12:00:00 AM.

Why do I get the time for the Variant and not for the string? Why we
get different results, depending whether the resulting variable is a
String or Variant. I am assuming that the time is being truncated for
the String and not for the Variant. Why?

Thanks,

Tom.

Nov 20 '05 #2
* Thomas Scheiderich <tf*@deltanet.com> scripsit:
I have the following page as test.aspx:
************************************************** *
<html>
<head>
<title>Hello and Welcome Page</title>
</head>
<body>
<center>
<%
Dim CurrentDate As String
CurrentDate = Today
%>
The current date is <%=CurrentDate %>.<br>
</center>
</body>
</html>
************************************************** *

If I have CurrentDate as String, like I do here, I get the following
page displayed:
The current date is 2/14/2004.

But if I take out the As String and have only "Dim CurrentDate", I get
the following result:
The current date is 2/14/2004 12:00:00 AM.

Why do I get the time for the Variant and not for the string? Why we


There is no variant datatype in .NET any more.

--
Herfried K. Wagner [MVP]
<http://www.mvps.org/dotnet>
Nov 20 '05 #3
Cor wrote:
Hi Tom,

This is a VB.net newsgroup.

I do not know if you get an answer here, but you get probably a better
answer in an ASP newsgroup.

You can try it in the newsgroup

microsoft.public.dotnet.framework.aspnet.

I hope you find your answer,

Sorry, I didn't know there was an ASPNET group. I had looked for it,
but must have had a little brain fade.

I'll repost it there as well as the one that follows.

Thanks,

Tom.

Cor

"Thomas Scheiderich" <tf*@deltanet.com> schreef in bericht
news:40**************@deltanet.com...
I have the following page as test.aspx:
************************************************ ***
<html>
<head>
<title>Hello and Welcome Page</title>
</head>
<body>
<center>
<%
Dim CurrentDate As String
CurrentDate = Today
%>
The current date is <%=CurrentDate %>.<br>
</center>
</body>
</html>
************************************************ ***

If I have CurrentDate as String, like I do here, I get the following
page displayed:

The current date is 2/14/2004.

But if I take out the As String and have only "Dim CurrentDate", I get
the following result:

The current date is 2/14/2004 12:00:00 AM.

Why do I get the time for the Variant and not for the string? Why we
get different results, depending whether the resulting variable is a
String or Variant. I am assuming that the time is being truncated for
the String and not for the Variant. Why?

Thanks,

Tom.



Nov 20 '05 #4
Herfried K. Wagner [MVP] wrote:
* Thomas Scheiderich <tf*@deltanet.com> scripsit:
I have the following page as test.aspx:
************************************************ ***
<html>
<head>
<title>Hello and Welcome Page</title>
</head>
<body>
<center>
<%
Dim CurrentDate As String
CurrentDate = Today
%>
The current date is <%=CurrentDate %>.<br>
</center>
</body>
</html>
************************************************ ***

If I have CurrentDate as String, like I do here, I get the following
page displayed:
The current date is 2/14/2004.

But if I take out the As String and have only "Dim CurrentDate", I get
the following result:
The current date is 2/14/2004 12:00:00 AM.

Why do I get the time for the Variant and not for the string? Why we

There is no variant datatype in .NET any more.

Then what am I getting, if I leave the "As String" out? Because it does
work, it just gives me the date and time, unlike the string which gives
me date only.

Tom.


Nov 20 '05 #5
* Thomas Scheiderich <tf*@deltanet.com> scripsit:
Then what am I getting, if I leave the "As String" out? Because it
does work, it just gives me the date and time, unlike the string which
gives me date only.


It will give you 'As Object'.

--
Herfried K. Wagner [MVP]
<http://www.mvps.org/dotnet>
Nov 20 '05 #6

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

Similar topics

6
by: Thomas Scheiderich | last post by:
I have the following page as test.aspx: *************************************************** <html> <head> <title>Hello and Welcome Page</title> </head> <body> <center> <% Dim CurrentDate As...
72
by: Stephen Poley | last post by:
I have quite often (as have probably many of you) come across HTML forms with irritating bits of Javascript attached. The last straw on this particular camel's back was a large form I was asked to...
4
by: kinne | last post by:
The following code is supposed to reverse the date in "yyyy-mm-dd" format, but it produces different results in Firefox 1.0 and in Internet Explorer 6SP1. In Firefox, the result is correct...
12
by: Steve Elliott | last post by:
I have a query set up to gather together data between two specified dates. Shown in the query column as: Between #24/09/2004# And #01/10/2004# Is it possible to enter several different date...
24
by: clare at snyder.on.ca | last post by:
I have a SQL query I need to design to select name and email addresses for policies that are due and not renewed in a given time period. The problem is, the database keeps the information for every...
9
by: Blarneystone | last post by:
Hi, I am using VB.NET and trying to pull data from two different tables in the database. I am using what I think is standard code. But the data I am pulling is like the following: Table1...
21
by: Darin | last post by:
I have an applicatoin that works 100% perfect when running on a machine setup for English (United States), but when I change it to Spanish (Mexico), the dates start giving me fits. THe reason is...
3
by: Bill Hutchison | last post by:
I have a query that returns different results (3508 rows for snapshot, 6288 for dynaset) and that is the only thing I change to get the different results. When I try to make a table from the...
0
by: billchalmers | last post by:
I am using sql 2005 express and I have a strange proble, when I execute a stored procedure from the query window I get the results I expect, but when I execute it from an asp page then I get a...
0
by: Kassimu | last post by:
Hi guys out there, There is this database Iam creating, I have a table with 40 fields among which there are Date/time, Text, Number, Memo and Yes/No fields and I have created the form bound to that...
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
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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
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
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...
0
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...
0
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...

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.