php mktime

Associate
Joined
26 Jun 2003
Posts
1,140
Location
North West
I have a date of birth field on a website which is stored in unix timestamp which of course only starts are 1970.

If the user selects a date of birth before this and I try to create a timestamp using mktime() and it results in 0, but what I want is -5631511 (or whatever) so I can work out their age etc.

How can I create a minus timestamp from a given date, eg:

$day = 11
$month = 1;
$year = 1900;

Thx
JD
 
Hmm it should be creating a timetamp actually but it isnt.

mktime(0, 0, 0, 9, 9, 1919);

works

but mktime(0,0,0, (int) $_POST['month'], (int) $_POST['day'], (int) $_POST['year']);isnt

hmm

I just worked out that 1903 is the earliest date I can use before it returns null.

Is it because an integer can only start at -2,147,483,648?

Is there anyway around this?
 
Last edited:
lol I know people wont be that old but its just id like to know if there is anyway around the problem.
 
"In my day, all we had was 32bits to play with, now look at you pesky kids with your 2048bit shennanigans! You don't know the meaning of limitations!"
 
Back
Top Bottom