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

Ticks to DateTime

How can I take a long variable from Datetime.Now.Ticks and restore that
number into a datetime variable?

Similar to the sample below that doesnt work.

Dim i as long = Datetime.Now.Ticks
Dim dt as Datetime = CType(i, datetime)

Thanks
Nov 21 '05 #1
2 15334
"Tommy" <to***@dontspamme.com> schrieb:
How can I take a long variable from Datetime.Now.Ticks and restore that
number into a datetime variable?


\\\
Dim n As Long = Now.Ticks
Dim d As Date = New Date(n)
///

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://classicvb.org/petition/>
Nov 21 '05 #2
Dang, i must need more coffee. I can't believe I didn't see that. Duh..

Thanks..

"Herfried K. Wagner [MVP]" <hi***************@gmx.at> wrote in message
news:uw**************@TK2MSFTNGP12.phx.gbl...
"Tommy" <to***@dontspamme.com> schrieb:
How can I take a long variable from Datetime.Now.Ticks and restore that
number into a datetime variable?


\\\
Dim n As Long = Now.Ticks
Dim d As Date = New Date(n)
///

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://classicvb.org/petition/>

Nov 21 '05 #3

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

Similar topics

1
by: Num | last post by:
Hi all, Sorry for cross-posting. I have to convert a J2EE date as a long ("Millis") in a .NET date as a long ("Ticks") In Java, currentTimeMillis, is the difference, measured in...
6
by: Michael Riggio | last post by:
Does anyone know a way to get system ticks in .Net? I found DateTime.Ticks, but that is equal to 100 nanoseconds. The reason I'm asking is because we're considering passing some sort of timestamp...
4
by: Jeroen CEuppens | last post by:
Hi, I want to measure a time (in ticks) between a couple of operations, with these code: long voor = DateTime.Now.TimeOfDay.Ticks; bmp1 = new Bitmap(@"\Network\im\ImageWeftIllum.bmp"); bmp2...
16
by: Tamir Khason | last post by:
Follow the code I have to check the performance double a = r.Next(9)*1e307; DateTime d = DateTime.Now; double b = Math.Pow(a,1/(double)100); TimeSpan tm = DateTime.Now - d;
1
by: TC | last post by:
Anyone know what this means Parser Error Message: Error loading XML file E:\Inetpub\wwwroot\web.config Ticks must be between DateTime.MinValue.Ticks and DateTime.MaxValue.Ticks. Parameter name:...
3
by: Ken Dopierala Jr. | last post by:
Hi, Here is C# code: Random rdm1 = new Random(unchecked((int)DateTime.Now.Ticks)); Can I do this in VB? I've tried CType(DateTime.Now.Ticks, Integer) and CInt(DateTime.Now.Ticks) but...
21
by: Willie jan | last post by:
place this behind a button that fills a listbox. as you will see the time is now and then 0 or filled in???????????? by hitting the button. is there a way to determine the real elapsed time? ...
1
by: fososs | last post by:
Hi all, Do you know any other way how to convert DateTime.Ticks (in Int64) to DateTime? I m using this way... Int64 AnyTicks = 633195783803593750; //for example ...
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...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

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.