Date/Time - Checking age verification prior to 1/1/1970?

When converting a date/time to a unix time stamp, how can I check if a user is older than 18yo, 21yo, 59 1/2, and 72 years old?

If the user is older than Jan 1, 1970, the negative number is _less than_ 72 years.

Seventy-two years in seconds is 2,264,371,200.

Seventy-two years in epoch/unix time is -631,152,000 (negative value).

Twenty-one years in seconds is 660,441,600.

Twenty-one years in epoch/unix time is 978,307,200 (positive value).

How would you do the math for a True/False result to check for = > 72 years?

How would you do the math for a True/False result to check for = > 21 years?

Subtracting from now with a negative number just gets me closer to 1970, but not the full time scale of negative value prior to 1970.

Do I need to run a conditional that if my epoch date is negative, then add(?) the seconds between 01/01/1970 and now?

Any help appreciated.

Other
3 replies