Re: Dates < then 1970

From: Date: Mon, 03 Nov 2003 23:41:45 +0000
Subject: Re: Dates < then 1970
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-168426@lists.php.net to get a copy of this message
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

« previous php.general (#168426) next »