Determine if it has been 6 months since birthday in c#

Posted by Longball27 on Stack Overflow See other posts from Stack Overflow or by Longball27
Published on 2010-04-29T15:13:06Z Indexed on 2010/04/29 15:27 UTC
Read the original article Hit count: 288

Filed under:
|
|

Hi,

Sorry if this is a duplicate, but i think I've seen enough of Google for one day!

My application needs to adjust a clients current age by +0.5 if it has been 6 months since their birthday.

The code should look something like this, but how many ticks would there be in 6 months?

if (DateTime.Today - dateOfBirth.Date > new TimeSpan(6))
        {
            adjust = 0.5M;
        }
        else
        {
            adjust = 0M;
        }

Thanks in advance

© Stack Overflow or respective owner

Related posts about c#

Related posts about datetime