[PHP] Dates < then 1970

2003-11-03 Thread Mark McCulligh
What function(s) would you use if you want to take someone's birth day and
format it on display.

I have always used strtotime, then strftime but it doesn't work if someone
was born in 1939. strtotime returns -1.

What function would you use to take the input string "1939/11/23" and get
the timestamp so I can use functions like strftime or date.

Thanks,
Mark.

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Dates < then 1970

2003-11-03 Thread John W. Holmes
Mark McCulligh wrote:

What function(s) would you use if you want to take someone's birth day and
format it on display.
I have always used strtotime, then strftime but it doesn't work if someone
was born in 1939. strtotime returns -1.
What function would you use to take the input string "1939/11/23" and get
the timestamp so I can use functions like strftime or date.
You'll have to tear it apart and do the math youself. Current year minus 
the first four digits. If current month/day is less than month/day from 
string, then subtract one (hasn't reached birthday yet).

If you're storing these dates in a database, you can use your query to 
calculate the age (unless it used unix timestamps, also).

--
---John Holmes...
Amazon Wishlist: www.amazon.com/o/registry/3BEXC84AB3A5E/

php|architect: The Magazine for PHP Professionals – www.phparch.com

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php