
Justus thank you for your response but I was a bit mixed with you code there are ambiguous types this is what I made it. Dim dpReturn As Date = CType(Me.dpReturnDate.Value, Date) Dim dpDue As Date = CType(Me.dpduedate.Value, Date) Dim MyDifference As TimeSpan MyDifference = dpReturn.Subtract(dpDue) ' find the number of days apart TextBox1.Text = CInt(MyDifference) now watch this CInt(MyDifference) can not be type casted. ahaaaaa men this thing is holding me up my previous code in the project looks like this stDate = CDate(.Item(3).ToString) ' this is a date stored in a database being converted to date dtDate = DateTime.Parse(stDate, Globalization.CultureInfo.CreateSpecificCulture("en-CA")) amount = DateDiff(DateInterval.Day, Now, dtDate) * fratepday ANY SUPPORT HIGHLY APPRECIATED On Thu, Aug 25, 2011 at 1:32 PM, justus <mutahijustus@gmail.com> wrote:
Try this
Dim dpReturn As Date = CType(Me.dpReturnDate.Value, Date) Dim dpDue As Date = dpDueDate.Value Dim dpReturn As Date = dpReturnDate.Value Dim dpDue As Date = CType(Me.dpReturnDate.Value, Date) Dim MyDifference As TimeSpan MyDifference = dpReturn.Subtract(dpDue) ' find the number of days apart
On Thu, Aug 25, 2011 at 1:06 PM, MICHAEL AKUNGA <michaelakunga@gmail.com>wrote:
I intend to get the difference of days between two given dates unfortunately all methods have used are firing an exception especially on type casting a string to date so far have used *DateTime.parse() and DateDiff() anyone any idea*
-- MICHAEL A. AKUNGA (+254) 0726 174 815 michaelakunga@gmail.com michaelakunga@yahoo.com
_______________________________________________ Skunkworks mailing list Skunkworks@lists.my.co.ke http://lists.my.co.ke/cgi-bin/mailman/listinfo/skunkworks ------------ Skunkworks Rules http://my.co.ke/phpbb/viewtopic.php?f=24&t=94 ------------ Other services @ http://my.co.ke
-- Justus +254 724 46 55 99
_______________________________________________ Skunkworks mailing list Skunkworks@lists.my.co.ke http://lists.my.co.ke/cgi-bin/mailman/listinfo/skunkworks ------------ Skunkworks Rules http://my.co.ke/phpbb/viewtopic.php?f=24&t=94 ------------ Other services @ http://my.co.ke
-- MICHAEL A. AKUNGA (+254) 0726 174 815 michaelakunga@gmail.com michaelakunga@yahoo.com