473,320 Members | 1,858 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 8928
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: 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...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
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: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you

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.