i have the following question.
how do i insert a datetime millisecond exact in interbase?
i know how to insert a normal datetime:
CStr(DateTime.Now.ToString("MM-dd-yyyy hh:mm"))
Not sure how to convert it back into a sensible date time, but
Code:
datetime.now.ticks
shows the number of milliseconds (100 nanosecond) intervals that have elapsed since 12:00 A.M., January 1, 0001.
I'm sure someone here can tell you how to convert it back to a date time - in fact the app im programming at the moment will need to do this at some point so I'd like to know how to do it as well
This works:
...
{
//Create a new DTM object and assign it to the Begining of time
//If you do not want beinging of time, create object with desried time
DateTime dt = new DateTime(0001,01,01,12,00,00,000);
//create long variable to hold the current number of ticks
long ticks = DateTime.Now.Ticks;
//Write out the time - Should equal current DTM
Console.WriteLine(dt.AddTicks(ticks));
Console.ReadLine();
}
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.