Massy Member Licensed User Longtime User Aug 23, 2014 #1 I have this Sub I found in the forum that makes me find the number of days passed between 2 dates: Code: Sub DaysBetweenDates(Date1 As Long, Date2 As Long) Return Floor((Date2 - Date1) / DateTime.TicksPerDay) End Sub it works all fine but I get a warning: "Return type (in Sub signature) should be set explicitly. (warning #3)" Anyone knows what is it about and how to fix it? Thanks for any help Massy
I have this Sub I found in the forum that makes me find the number of days passed between 2 dates: Code: Sub DaysBetweenDates(Date1 As Long, Date2 As Long) Return Floor((Date2 - Date1) / DateTime.TicksPerDay) End Sub it works all fine but I get a warning: "Return type (in Sub signature) should be set explicitly. (warning #3)" Anyone knows what is it about and how to fix it? Thanks for any help Massy
NJDude Expert Licensed User Longtime User Aug 23, 2014 #2 You can ignore that, if you like you can change the signature of that sub like this: Code: Sub DaysBetweenDates(Date1 As Long, Date2 As Long) As Double or just prevent that warning for showing by doing this: Code: Sub DaysBetweenDates(Date1 As Long, Date2 As Long) 'ignore Last edited: Aug 23, 2014 Upvote 0
You can ignore that, if you like you can change the signature of that sub like this: Code: Sub DaysBetweenDates(Date1 As Long, Date2 As Long) As Double or just prevent that warning for showing by doing this: Code: Sub DaysBetweenDates(Date1 As Long, Date2 As Long) 'ignore
Erel B4X founder Staff member Licensed User Longtime User Aug 24, 2014 #3 If you don't explicitly set the return type then it is considered to be string. The compiler will convert the number to string and back to a number for you. However it is better to correctly set the type instead. Upvote 0
If you don't explicitly set the return type then it is considered to be string. The compiler will convert the number to string and back to a number for you. However it is better to correctly set the type instead.
Massy Member Licensed User Longtime User Aug 30, 2014 #4 NJDude said: You can ignore that, if you like you can change the signature of that sub like this: Code: Sub DaysBetweenDates(Date1 As Long, Date2 As Long) As Double Click to expand... Thanks a lot Dude! Sorry for the late answer but I was out of town... Thanks again Massy Upvote 0
NJDude said: You can ignore that, if you like you can change the signature of that sub like this: Code: Sub DaysBetweenDates(Date1 As Long, Date2 As Long) As Double Click to expand... Thanks a lot Dude! Sorry for the late answer but I was out of town... Thanks again Massy