vb.net - DateTime : Month Diffenece Formula in VB? -
i mean, how write formula this:
dec2013-feb2014, result = 3 (from december february, jump 3 time) jan2014-feb2014, result = 2 (from january february, jump 2 time) feb2014-feb2014, result = 1 (in same month 1 time)
then have
textbox1.text -> month before
textbox2.text -> month after
textbox3.text -> result
button1.text, button result in textbox3.text
if write textbox1.text = "20-may-2012", textbox2.text = "20-feb-2014", wanna textbox3.text = 22.
if write textbox1.text = "20-may-2013", textbox2.text = "20-feb-2014", wanna textbox3.text = 10.
if write textbox1.text = "20-dec-2013", textbox2.text = "20-feb-2014", wanna textbox3.text = 3
if write textbox1.text = "20-jan-2013", textbox2.text = "20-feb-2014", wanna textbox3.text = 2
if write textbox1.text = "10-feb-2013", textbox2.text = "20-feb-2014", wanna textbox3.text = 1
and on.
how write month jumping formula?
you can datediff function in vb.net
dim dattim1 date = textbox1.text dim dattim2 date = textbox2.text dim wd long = datediff(dateinterval.month, dattim1, dattim2) textbox3.text = wd
Comments
Post a Comment