Calculating Age Part 2: Check the Accuracy of Calculations in my Original Microsoft Access Age Video

Поделиться
HTML-код
  • Опубликовано: 14 окт 2024

Комментарии • 30

  • @rabidfollower
    @rabidfollower 3 года назад

    Richard, thanks for responding via this video. Regarding your method for getting 100% correct age, it would fail if the DOB was on 2/29 in a leap year and today's date is on 2/28 in a common year. For instance, if DOB is 2/29/2000 and today's date is 2/28/2021, this person is exactly 20 years 365 days old. That makes him 21 according to our government, because the IRS considers 365 days as one year no matter what. But your function would think that since 2/29 comes after 2/28, less than a year must have passed, so it deducts one year. But because of the extra day in a leap year, there are, in fact, 365 days (not 364) between 2/29/leap year and 2/28/next common year. So this method is tripped up by leap years just like dividing by 365.25. But of course, you could modify your function to specially check for 2/29/LY and 2/28/CY. And 2/29 is the only day this would happen to, simply because it is an extra day. All other dates in a leap year are not affected. E.g. 4/2/LY to 4/1/NCY is only 364 days, and your function would work.

    • @599CD
      @599CD  3 года назад

      I would love to see your source saying that the IRS considers "20 years and 365 days old" to be equivalent to 21 years. I did a little research this morning, and everything I've found says that if you're born on 2/29, then you're 21 once 2/28 at 11:59:59pm passes. This would mean March 1st. Legally. tinyurl.com/yex4yxmj - Now that's for the United States. I also did find that some other countries have different laws. New Zealand makes the official birthday for Leap Babies Feb 28th. tinyurl.com/yebxm8x5

    • @rabidfollower
      @rabidfollower 3 года назад

      @@599CD I think your first link already has the answer. Near the end, the article says "365 days counts as one year, and 2/28 and 2/29 count as one day in a leap year." The New York law I quoted (Google "New York state law section 58 GCN") also says the same thing. That essentially makes every year equal to 365 days. When the lawyer in the article says a 21-year-old shouldn't be drinking until 3/1, that seems to be her (erroneous) opinion only. The laws and facts she quotes don't bear that out. She also probably doesn't know that the day of birth is DAY ONE of a person's life, not day zero. If you celebrate your birthday on on 2/29/LY, you count that day as day 1. Then the 365th day after that will be 2/27 of next year. And that's why 2/28 should be the birthday, if we go by the "365 days makes a year" rule.

  • @maheshdhaygude4665
    @maheshdhaygude4665 3 года назад

    Hi sir ! Your videos are very helpful for learning access . I am learner and my problem is that , how can I secure my database from piracy by using "Activation Key ". How to create Activation Key only for paid users only on one pc and how to prevent them to use copy of database .Can you explain in detail in next video .It would very helpful for me and my all friends who are waiting for your every video .

    • @599CD
      @599CD  3 года назад

      See this: 599cd.com/Registration

  • @arunsingh768
    @arunsingh768 3 года назад

    Dear sir ur video for converting reports to pdf was very useful but only problem is that report is not splitting. Pls upload the video to split the report n save with individual name or unique name

    • @599CD
      @599CD  3 года назад

      What do you mean splitting?

  • @joefensterblau5169
    @joefensterblau5169 3 года назад

    I have this in one of my databases that I designed years ago. I don't remember where I found it. It seems to be 100% accurate. =DateDiff("yyyy",[Birthday],Now())+Int(Format(Now(),"mmdd")

    • @599CD
      @599CD  3 года назад

      Looks good. Haven't tested it though.

    • @rabidfollower
      @rabidfollower 3 года назад

      Joe, your method would fail the same way Richard's would: if the birth date is 2/29/2000 and today's date is 2/28/2021, this person is technically 21 years old but your and Richard's method would return 20. This method is tripped up by the leap year like all the other methods. I mentioned this in another post here, but Richard hasn't addressed it. I know this is only a math issue and isn't really the purview of his channel (which is an exellent channel), but it is still important to note that all these methods are NOT hundred percent correct as claimed.

    • @599CD
      @599CD  3 года назад

      Followup is coming. I just haven't commented on it yet because I haven't had time, and once I comment on it then it won't show up in my "messages you haven't commented on yet" list. LOL. It's coming. Been a busy month so far. :)

    • @joefensterblau5169
      @joefensterblau5169 3 года назад

      @@rabidfollower
      Hello Rabid, Master Richard's and mine both return correct dates for your four other date ranges. The only one that you have an issue with is the 2/29. After researching the subject, it seems the legal age change is March 1st, the day after the 28th. As Master Richard stated, you are safer being shy with the age than going over for legal purposes. This is 100% correct in my opinion. Now... I believe I have the solution for 100% using 2/29 instead of 3/1. I will also include my new version of 100% with March 1st. Thank you Master Richard for all of your videos. I watch all of them as they come out!!! Let me know what you think Rabid. Thank you!
      100% using March 1st... =IIf(Month([Birthday])=Month([txtDate]) And Day([Birthday])

    • @rabidfollower
      @rabidfollower 3 года назад

      @@joefensterblau5169 Some states have laws that say 2/28 is the birthday, some say 3/1 is, and some states don't have laws that clarify this at all. In Richard's first video on age, the original questioner was from New York state, which does have a law that says 365 days counts as a year. That means a person born on 2/29/leap year turns 21 on 2/28/common year, because that's exactly 20 years and 365 days. Google "New York state law section 58 GCN" should take you to the link that shows this law. Regarding your formula for 2/28 as birthday, it is unfortunately also not 100%. If someone was born on 2/29/2000 and today's date is 2/28/2020 or 2/28/2019, your formula will return age 19 for both, which is clearly not right. If the drinking age is 21, then this mistake is not a big deal. But we still need to note that your latest method is still not 100% correct.

  • @tutsecret499
    @tutsecret499 3 года назад

    I was making some imaginary dates to create AgeGrp, but I noticed that when I put 08/10/20 and 08/10/21 it does not show 1 year for the baby when shows up on the clinic on 8/10/21, but if I put 08/10/20 and 08/11/21(clinic visit) the following day, then it shows 1 year on the Age calculation query. Then I used another imaginary date for elderly person 08/10/1920 and 08/10/1921 and the elderly person gets the age right as 100 years. So why the baby has to wait until midnight to show 1 year and I used your formula Age at the time of clinic visit: Int(#08/10/2021#-[DOB])/365.2425) from your video Age #1 or using today() instead of specific date. The reason I don't use today date, because we want to know how old the patient was at the time of the infection illness started when we look at the database in the future. So can I use your formula for retirement due date

    • @599CD
      @599CD  3 года назад

      Yeah, if that's the case, use calculation #2 for a more exact age.

  • @1936Rock
    @1936Rock 3 года назад

    How do you calculate the age if you only have their birthdates?

    • @599CD
      @599CD  3 года назад

      That's exactly what you need to calculate their age. Are you saying that you don't have a COMPLETE birthdate? If you're missing part of it, you can't do it.

    • @1936Rock
      @1936Rock 3 года назад +1

      @@599CD Thanks for the response. I used Joe's example below and it worked perfectly for me. Just needed the Now() example parts.

  • @tutsecret499
    @tutsecret499 3 года назад

    Do you have formula to calculate age months for baby. under 1 year

    • @599CD
      @599CD  3 года назад

      That would just be a simple DateDiff. 599cd.com/DateDiff

  • @HankMegens
    @HankMegens 3 года назад

    Function fLeeftijd(geb_dat As Variant) As Byte
    If IsNull(geb_dat) Then
    fLeeftijd = 0
    Else
    If IsDate(geb_dat) Then
    If Format(geb_dat, "mmdd") > Format(Date, "mmdd") Then
    fLeeftijd = DateDiff("yyyy", geb_dat, Date) - 1
    Else
    fLeeftijd = DateDiff("yyyy", geb_dat, Date)
    End If
    Else
    fLeeftijd = 0
    End If
    End If
    End Function

    • @599CD
      @599CD  3 года назад +1

      Looks overly complicated. :)

    • @HankMegens
      @HankMegens 3 года назад

      @@599CD buy IT works tot me.

    • @rabidfollower
      @rabidfollower 3 года назад

      @@HankMegens Your function basically does the same thing as Richard's, but Richard's code is much simpler, which is something all programmers should strive for. However, both your functions would fail if the DOB was on 2/29 in a leap year and today's date is on 2/28 in a common year. For instance, if DOB is 2/29/2000 and today's date is 2/28/2021, this person is exactly 20 years 365 days old. That makes him 21 according to our government, because the IRS considers 365 days as one year no matter what. But your function would think that since 2/29 comes after 2/28, less than a year must have passed, so it deducts one year. But because of the extra day in a leap year, there are, in fact, 365 days (not 364) between 2/29/leap year and 2/28/next common year. So Richard, this method is tripped up by leap years just like dividing by 365.25. But of course, you could modify your function to specially check for 2/29/LY and 2/28/CY. And 2/29 is the only day this would happen to, simply because it is an extra day. All other dates in a leap year are not affected. E.g. 4/2/LY to 4/1/NCY is only 364 days, and your function would work.