Convert date to seconds

Hi,

there are various ways of calculating and displaying a time and date from Unix time.
But how does it work the other way around?
The problem: My users enter their birthday in year, month, day, each a variable.
How do I get the date of birth (or any other date) in seconds (Unix time)?
I can calculate the years since 1970 and multiply by 365*86400.
I can calculate the past months and days in seconds.
I can calculate and add the leap years between the year of birth and today using the mod function.
But, all seconds in the sum result in a small gap to the Unix time (approx. 14 minutes).

Example: How do I get the Unix time of 998690400 for August 25, 2001 00:00h?

Thank you.

Lets make a deal
You teach me how to convert time into seconds
I teach you how to achieve what you want

I understand logic i just don’t know how to do it
I know by multiplying time by seconds but whatever

What you wanna do
Imagine i set my birthday as to 3 days ago

So FOR EXAMPLE i set my birthday to
2000 Januray 20 Variable(BirthDate)
So all you need to do to check what date is today
2000 january 23 Variable(CurrentDate)

And now you subtract birth from current date
But before you can do it you need to convert all values to seconds

When you have like 422154188221 seconds after converting current date
Then you go with
Variable(CurrentDate) - Variable(BirthDate)

And now you convert result from seconds to time
And you will know that i am 3 days old

IF you would have only my age but not birth date
Then you go with

Convert years into seconds store in Variable(Age)

Variable(CurrentDate) - Variable(Age)
Convert result to date
You have date of my birthday

Now that i read your question again i think i may understand it wrong

Leap year isn’t every 4 years.

Every year that is exactly divisible by four is a leap year, except for years that are exactly divisible by 100, but these centurial years are leap years if they are exactly divisible by 400. For example, the years 1700, 1800, and 1900 are not leap years, but the years 1600 and 2000 are

For living people, this shouldn’t be an issue.

This would probably be easier to do with JavaScript.

Hi Keith,

yes I know, you’re right. That’s why I only calculate the existing leap years and add the seconds:

With PHP ( example: $timestampbirth = strtotime(‘8/25/2001’); ) I could quickly fix the problem, but I don’t want to create an external connection to a server just because of this one function. I want to save everything in the game.