D
Danny J. Lesandrini
Maybe I'm missing something, but a search of Google suggested that I need to do the
following to perform DateDiff in VB .Net with native CLR calls. Watch for word wrap ...
there's plenty of room for it with the verbosity of this code ...
Dim d1 As Date = DateTime.Parse(txtEndDate.Text.ToString, System.Globalization.DateTimeFormatInfo.CurrentInfo)
Dim d2 As Date = DateTime.Parse(txtStartDate.Text.ToString, System.Globalization.DateTimeFormatInfo.CurrentInfo)
Dim ts As TimeSpan = d1.Subtract(d2)
Dim DateRangeWarning As Integer= ts.Days
How is that code "better" than this ...
Dim DateRangeWarning As Integer= DateDiff(DateInterval.Day, CDate(txtStartDate.Text), CDate(txtEndDate.Text))
The DateDiff call works in VB .Net but of course it's legacy code. Does this mean that
any time I want to use DateDiff, I need to instantiate 3 seperate objects? Thank goodness
for automatic garbage collection.
Danny Lesandrini
(e-mail address removed)
following to perform DateDiff in VB .Net with native CLR calls. Watch for word wrap ...
there's plenty of room for it with the verbosity of this code ...
Dim d1 As Date = DateTime.Parse(txtEndDate.Text.ToString, System.Globalization.DateTimeFormatInfo.CurrentInfo)
Dim d2 As Date = DateTime.Parse(txtStartDate.Text.ToString, System.Globalization.DateTimeFormatInfo.CurrentInfo)
Dim ts As TimeSpan = d1.Subtract(d2)
Dim DateRangeWarning As Integer= ts.Days
How is that code "better" than this ...
Dim DateRangeWarning As Integer= DateDiff(DateInterval.Day, CDate(txtStartDate.Text), CDate(txtEndDate.Text))
The DateDiff call works in VB .Net but of course it's legacy code. Does this mean that
any time I want to use DateDiff, I need to instantiate 3 seperate objects? Thank goodness
for automatic garbage collection.
Danny Lesandrini
(e-mail address removed)