Answered by:
How to add fraction of seconds to Date Time?

Question
-
Dear Friends,
I know that Second, Minute, Hour, day, Month & year can be added to Date, by using function "DateAndTime.DateAdd() function; for example; adding 2 seconds to the "Date1"
DateAndTime.DateAdd(DateInterval.Second,2,Date1)
I want to add milliseconds to Date and then I want to use " datePart(DateInterval. , Date)" to get the Year, month..... second and milliseconds (Or as fraction of Second) to use in other calculation.
Can you please help?
Thanks
VKSBK
A Real Novice Programmer !
Answers
-
- Marked as answer by V.K.S.B.K Monday, September 16, 2019 9:27 AM
-
I couldn't find any function for getting the "Millisecond" from Date.
- Marked as answer by V.K.S.B.K Monday, September 16, 2019 9:27 AM
All replies
-
- Marked as answer by V.K.S.B.K Monday, September 16, 2019 9:27 AM
-
Hi Castorix31,
Thanks for the reply; I tried your method and was able to add milliseconds...
Module Module1 Sub Main() Dim DateTest1 As Date = #9/15/2019 10:30:00 AM# Dim SecAddedDate As Date For i = 1 To 20 SecAddedDate = DateTest1.AddMilliseconds(100 * i) Console.WriteLine("Adding 100 MilliSeconds to 10:30:00 am = " & SecAddedDate & vbCrLf) Next End Sub End Module
Now, please let me know how to get the "added milliseconds" from the "SecAddedDate", like what we get using " datePart(DateInterval. , Second, 'Date')" ?
I couldn't find any function for getting the "Millisecond" from Date.
Could you please help me on this one also?Thanks
VKSBK
A Real Novice Programmer !
-
I couldn't find any function for getting the "Millisecond" from Date.
- Marked as answer by V.K.S.B.K Monday, September 16, 2019 9:27 AM
-