How old are you?
-
Public ReadOnly Property Age As Integer Get Return CInt(Math.Truncate(((DateTime.Now - _birthday).TotalDays / 365))) End Get End Property
Too old.
-
That's a special way of doing that particular task.
-
[spoiler]And it gives a faulty result if you get close to someone's birthday (I'd get a faulty result on the 23rd of January, for example).[/spoiler]
-
The bigger problem is not handling leap years. Still, once you get 21, a month or two in either way doesn't matter much, so it's only minor WTF.
-
Why didn't they just use TotalYears?
*checks MSDN*
Oh. That's why.
http://msdn.microsoft.com/en-us/library/System.TimeSpan_properties(v=vs.110).aspx
A better solution would be
DateTime.Today.Year - _birthday.Year
, although that doesn't deal with whether you've actually had your birthday this year or not.
-
DateTime.Today.Year - _birthday
- IIf(DateTime.Now.DayOfYear > birthday.DayOfYear, 0, 1)
-
This looks like a good interview question.
-
@Jaloopa - Off by one when one of them is a leap year...
-
-
-
-
-
-
-
Post ID was 10.
Topic ID was 7099.edit: Hanzo!
-
-
-
Post ID was 10.
post_number may have been 10 (well no - it was 11), but I'm fairly certain the post:id was not...
Nope. post_number not divisible by neither 5 (it is, happily, divisible by 3 though....)
So what exactly did you think was '10'? 10th reply to the OP? You might have a case with that one.....
post_number: Fizz
post:id: Fizz
-
Oh whatever the last number in the URL is.
Boomzilla's post was /10.
Post number, I guess.
-
Because it doesn't have a TotalYears member 😜
-
I hate you all.
-
-
```VB.NET
Public ReadOnly Property Age As Integer
Get
Return CInt(Math.Truncate(((DateTime.Now - _birthday).TotalDays / 365)))
End Get
End PropertyToo old.</blockquote>
var age = DateTime.Now.Year - birthday.Year
if (DateTime.Now.Month < birthday.Month) age--;
else if (DateTime.Now.Month == birthday.Month && DateTime.Now.Day < birthday.Day) age--;
-
final String theWorstOfTheWorst = mikeTheLiar;
-
-
-
-
-
mikeTheLiar was an Object initialised previously.
-
31
-
Old enough that I used to think my current age is "really really old".
Young enough that I can still remember thinking "Geez that's old!" when my Dad was this age.
Chronological age has advanced far more rapidly than the age I feel, that's for sure. I'm scared of the day I start thinking I'm too old for this shit.
Also, Fizz.
-
Hmm.. never answered the original question.
I'm 29 (30 on Feb 16th)
-
Because it doesn't have a TotalYears member 😜
Obviously. You can't determine how many years or even months a timespan has without having at least one endpoint. I mean, how many months is 30 days? Is it 1, 30/31, 1 and 2/28 or 1 and 1/29?
Filed under: flies away, inb4 leap seconds
-
(30 on Feb 16th)
Same as Levar Burton and Kim Jong-Il!Wait... are you Kim Jong-Il? Has anyone ever seen RaceProUK and Kim Jong-Il in the same place?
-
For me its "eighty six oh six oh two. You can do the math from there."
-
I share my birthday with John Lennon, Jackson Browne and David Cameron. Two of those are worthy of using my birthday. The other, not so much.
-
-
-
Ono, I have no problem with him
-
What do you have against Lennon?
If nothing else, his wife (whose twitter feed is Poe's Law in 140 chars or less) and that retarded "Imagine" song.