LearningToTalk / L2TDatabase

Helper functions for working with our lab's MySQL database
GNU General Public License v2.0
0 stars 0 forks source link

how do we calculate "AgeAtVisitA" column #5

Closed tjmahr closed 8 years ago

tjmahr commented 8 years ago

Round up or round down months?

tjmahr commented 8 years ago

Round down, kinda!

Formula from UW Excel spreadsheet:

=DATEDIF(BirthDate,DateVisitA,"m")&" months"

DATEDIF is not documented. But it appears that it uses "completed units" of time.

image

Each month here is not 30 days but the number of months completed. Knowing just the number of days between two dates doesn't let us compute the value of datedif. We have to know the two dates. It's kind of weird.