...
New to C# ---- How do I convert a Date to int?
In VB6:
Dim lDate as long
lDate = CLng(Date)
In C#
int lDate;
Then what?
Well, AFAIR, a Date in VB6 was internally represented by a double, where the
fractional part represented the time of day.
In .NET a DateTime isn't the same thing, and you won't get the same integer
value.
Here a DateTime has "ticks" which is a long, representing the number of
100-nanoseconds since the epoch (which date now that was).
So, the question is rather what you want it for, and how you're going to use
it?
If it simply is to store away it as an integer value, or vice versa, you can
use the ticks, e.g.:
DateTime d = new DateTime(632820056780400000);
long ticks = d.Ticks;
Note that it's not an int, it's a long.
// Bjorn A