How can I get the date with Milliseconds?

  • Thread starter Thread starter Kevin Thomas
  • Start date Start date
K

Kevin Thomas

Hello,

I have a date value in a table SQL Server database that looks like this:
2005-10-11 12:54:36.860

When I load the record into a dataset in VB.NET and retrieve the date value
into code, what I get is:
#10/11/2005 12:54:36 PM#

It has chopped off the milliseconds. How do I get the full date and time
with milliseconds returned? In other words, what I need back is either
this:
2005-10-11 12:54:36.860
or this
#10/11/2005 12:54:36.860 PM#


Thanks,

Kevin
 
Kevin Thomas said:
I have a date value in a table SQL Server database that looks like this:
2005-10-11 12:54:36.860

When I load the record into a dataset in VB.NET and retrieve the date value
into code, what I get is:
#10/11/2005 12:54:36 PM#

It has chopped off the milliseconds. How do I get the full date and time
with milliseconds returned? In other words, what I need back is either
this:
2005-10-11 12:54:36.860
or this
#10/11/2005 12:54:36.860 PM#

Well, there are two issues here:

1) Formatting a date to include milliseconds
2) Whether or not you're retrieving all the information in the first
place

1) can be sorted by looking up "date and time format strings" in MSDN.
That will show you whether 2) is actually a problem or not - I suggest
you check out 1) and then come back to us as to whether any data is
actually being lost.
 
Hello,

No data is being lost, it's just that when you access the value in the
dataset, without specifying any formatting you get the date and time without
the milliseconds. The article in MSDN you pointed me to showed me how to
correctly specify a format that returned the milliseconds.

Thanks,

Kevin
 
Back
Top