How to subtract dates in YYYYMMDD format?

Posted by NinjaBomb on Stack Overflow See other posts from Stack Overflow or by NinjaBomb
Published on 2010-05-11T20:17:33Z Indexed on 2010/05/11 20:24 UTC
Read the original article Hit count: 222

Filed under:
|
|
|

I have 2 integer fields that represent dates in the YYYYMMDD format. What is the best way to subtract 2 of these fields to get the correct # of days between them?

For instance, if I take the difference between 20100511 and 20100428 I would like the result to be 13 and not 83. I know I need to convert the integer fields into date formats but everything I have tried either throws an exception or doesn't work correctly.

What am I missing? Answers in vb.net please

© Stack Overflow or respective owner

Related posts about vb.net

Related posts about .NET