Posts

Showing posts from 2013

MSBI (SSAS, SSRS and SSIS) Training

Hi Guys, Anyone interested in online training for MSBI (SSAS, SSRS and SSIS), please contact @ er.lokeshsharma08@gmail.com. Features - Best material (practical and theoretical) for becoming familiar with this latest exciting technology.

Effect of using operator '-' with dates in vb6

Recently I encountered a problem of handling dates while converting a vb6 code to .net code. Problem - cant predict what the output of (date1 - date2 ) would yield in vb6 Solution - vb6 stores dates as doubles so if we use an arithmetic operator such as '-' and '+', the result would be in double which then will be converted to date. so in order to replicate something like this in .net please try the following code: Dim i As Date, k As Double, j As Date   i = "01/01/2000"   k = 23 / 12 - CDbl(i.ToOADate())    j = CDate(Date.FromOADate(k)) It is better if we use all the date functions such as datediff, dateadd while dealing with dates in vb.net however if we want to replicate the above behavior we can definitely use above code snippet.