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

How can I get the date with Milliseconds?

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
Oct 12 '05 #1
2 8927
Kevin Thomas <Se**********@Spam.com> wrote:
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.

--
Jon Skeet - <sk***@pobox.com>
http://www.pobox.com/~skeet Blog: http://www.msmvps.com/jon.skeet
If replying to the group, please do not mail me too
Oct 12 '05 #2
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
"Jon Skeet [C# MVP]" <sk***@pobox.com> wrote in message
news:MP************************@msnews.microsoft.c om...
Kevin Thomas <Se**********@Spam.com> wrote:
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.

--
Jon Skeet - <sk***@pobox.com>
http://www.pobox.com/~skeet Blog: http://www.msmvps.com/jon.skeet
If replying to the group, please do not mail me too

Oct 12 '05 #3

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

Similar topics

26
by: sgershon | last post by:
Hi. I know this is should be a simple question. I know server-side web-programming, and never needed to use client-side scripting... until now :) I have done so far a little number of scripts...
6
by: Jim Davis | last post by:
Before I reinvent the wheel I thought I'd ask: anybody got a code snippet that will convert the common ISO8601 date formats to a JS date? By "common" I mean at the least ones described in this...
2
by: Kevin Thomas | last post by:
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,...
26
by: jshanman | last post by:
I am writing a timeline that uses Google Maps. I have a function that converts a date time to latitude coords. This function is used to draw the markers on the timeline. I need a reverse function...
2
by: Rajat | last post by:
Hi, I have to draw a real time chart in which I have several entries at the same second (i.e. HH:MM:SS:Milleconds) The charting component only takes julian date for drawing the dates. I am...
6
by: rohayre | last post by:
Im a long time java developer and actually have never done anything with java scripting. I'd like to write a short simple script for calculating a date in the future based on today's date and a...
2
by: vinodtr | last post by:
Hi all, I have a date which is represented by the number of milliseconds since January 01, 1970. I need to change this back to DATE format. Is there any built in function in DB2 to do the needed...
16
by: Nathan Sokalski | last post by:
I have a control uses the date and time, including milliseconds. I want to be able to enter this information as an attribute in the *.aspx page. Because all attributes are entered as strings in the...
4
by: anagai | last post by:
I just want to check if a date entered in a textbox is equal to the current system date. I set the date object from the input field like this: dt1=new Date('10/01/2007'); the current system...
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

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.