![]() |
since last update
i'm trying to make a script and cant get any of them working
say i have a string: PHP Code:
then calculate how many days have past and display it as PHP Code:
Talonos |
$date = substr($lastupdate, 0, 10); // will remove the time
$date_ = explode('-', $date); $day = $date[2]; This is not ideal. What version of php are you running. The latest version (php 5.3) has some very cool and easy to use date manipulation functionality. Or you could use Zend_date to achieve the same. Else I would convert it to a unix time stamp and do the calculation from there. |
my PHP Version is 5.2.10 and i cant update it :(
also your script works perfect m8 with a few adaptations :) |
Cool, glad it worked :)
|
If you are using PHP 5.2 or better then you can use most of the DateTime functions:
PHP Code:
> http://us.php.net/manual/en/class.datetime.php > http://us.php.net/manual/en/datetime.format.php > http://us.php.net/manual/en/datetime.modify.php |
Really? I thought that was only in php5.3 and above?
|
Check the links I gave to the docs. Only some of the DateTime functions require PHP 5.3. I'm running PHP 5.2.9 right now on my local box and it works perfectly.
|
| All times are GMT. The time now is 01:44 PM. |
Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.1.0