Date time incorrect

  • Thread starter Thread starter Bob Day
  • Start date Start date
B

Bob Day

Using VS 2003, VB.NET, MSDE...


This is incredible misleading that the following produces a results of
#2/13/04# if you hover your mouse over the Date_Time_Begin, although I do
think its value is #2/13/04 12:00:00AM#. This should be correct.

' convert into date.

Dim Date_Time_Begin As DateTime = CDate("#2/13/04 12:00:00 AM#")

Please advise

Bob Day
 
Bob Day said:
Using VS 2003, VB.NET, MSDE...


This is incredible misleading that the following produces a results
of #2/13/04# if you hover your mouse over the Date_Time_Begin,
although I do think its value is #2/13/04 12:00:00AM#. This should
be correct.

' convert into date.

Dim Date_Time_Begin As DateTime = CDate("#2/13/04 12:00:00 AM#")


#2/13/04# and 2/13/04 12:00:00AM# are equal, so I don't see the point.

--
Armin

How to quote and why:
http://www.plig.net/nnq/nquote.html
http://www.netmeister.org/news/learn2quote.html
 
* "Bob Day said:
Using VS 2003, VB.NET, MSDE...


This is incredible misleading that the following produces a results of
#2/13/04# if you hover your mouse over the Date_Time_Begin, although I do
think its value is #2/13/04 12:00:00AM#. This should be correct.

I am not sure what's the problem. Are you referring to the missing time
part?
 
Hi Bob,

From your description, it seems that you are in debug mode, so that when
you hover your mouse over the Date_Time_Begin, you will see the #2/13/04#

MSDN said the January 1, 0001 or 00:00:00 will be a neutral value. So the
result string did not include the January 1, 0001 or 00:00:00 .

12:00:00 AM means 00:00:00 in .net.

The Date data type always contains both date and time information. For
purposes of type conversion, Visual Basic .NET considers 1/1/1 (January 1
of the year 1) to be a neutral value for the date, and 00:00:00 (midnight)
to be a neutral value for the time. If you convert a Date value to a
string, CStr does not include neutral values in the resulting string. For
example, if you convert #January 1, 0001 9:30:00# to a string, the result
is "9:30:00 AM"; the date information is suppressed. However, the date
information is still present in the original Date value and can be
recovered with functions such as DatePart.

Type Conversion Functions
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vblr7/html/
vagrptypeconversion.asp

You may try to change the #2/13/04 12:00:00AM# to #2/13/04 12:01:00AM# to
see if you can see complete format.

Best regards,

Peter Huang
Microsoft Online Partner Support

Get Secure! - www.microsoft.com/security
This posting is provided "AS IS" with no warranties, and confers no rights.
 
Hi Bob,

Thanks for posting in the community.

Did you still have any concern on this issue about DateTime format?
If so, please post here and I will work on with you.

Best regards,

Peter Huang
Microsoft Online Partner Support

Get Secure! - www.microsoft.com/security
This posting is provided "AS IS" with no warranties, and confers no rights.
 
Back
Top