Re: Different results if you have String or a Varient for Dates?
From: Bob Barrows (reb01501_at_NOyahoo.SPAMcom)
Date: 02/15/04
- Next message: Roland Hall: "Re: response.redirect "bla.php""
- Previous message: dalyjason: "response.redirect "bla.php""
- In reply to: Thomas Scheiderich: "Different results if you have String or a Varient for Dates?"
- Next in thread: Thomas Scheiderich: "Re: Different results if you have String or a Varient for Dates?"
- Reply: Thomas Scheiderich: "Re: Different results if you have String or a Varient for Dates?"
- Messages sorted by: [ date ] [ thread ]
Date: Sun, 15 Feb 2004 09:38:02 -0500
Thomas Scheiderich wrote:
> 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?
>
> Tom.
The Date datatype contains time as well as the date, just like in Access and
SQL Server. Dates are numbers with subType Double. the whole number
represents the number of days since the seed date, and the decimal portion
represents the time of day (.0 = midnight, .5 = noon). If you provide a date
without providing the time (which I guess is what the Today function is
doing), the date is stored as nnnnn.0. So when that date is written, the
"12:00 AM" is included.
Bob Barrows
PS. This is a classic asp newsgroup. .Net questions should be asked in the
appropriate "dotnet" newsgroup. There are several in that hierarchy.
-- Microsoft MVP - ASP/ASP.NET Please reply to the newsgroup. This email account is my spam trap so I don't check it very often. If you must reply off-line, then remove the "NO SPAM"
- Next message: Roland Hall: "Re: response.redirect "bla.php""
- Previous message: dalyjason: "response.redirect "bla.php""
- In reply to: Thomas Scheiderich: "Different results if you have String or a Varient for Dates?"
- Next in thread: Thomas Scheiderich: "Re: Different results if you have String or a Varient for Dates?"
- Reply: Thomas Scheiderich: "Re: Different results if you have String or a Varient for Dates?"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|