Jason FB wrote:
Can anyone tell me how to convert a date stored in the format "YYYY-MM-DD" to an integer of seconds since unix epoc,

then add $daysToAdd days to this value (I suppose if the integer was a number of seconds it would have to be $daysToAdd*60*60*24 to get the number of seconds to add)

then convert the new value to a timestamp which I can output using the function

string date ( string format [, int timestamp])

Is this a MySQL timestamp? If so, you can use TO_UNIXTIME() in your query to return a Unix timestamp instead of a MySQL one. You can use DATE_ADD() to add days to the timestamp. You can also use DATE_FORMAT() to format the timestamp before it's returned also.


If you don't want to do that, what's wrong with strtotime('YYYY-MM-DD') to get the unix timestamp?

--

---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



Reply via email to