On Nov 14, 2007, at 4:21 PM, Jürgen Wind wrote:
better use Date() in js ...
tedd-2 wrote:
Current date/time for whom?
For your server, use php's date().
For the user, use javascript's date().
It's so cool to be multilingual. :-)
Cheers,
tedd
I don't know that that's better. Then, suddenly, on an otherwise
simple website, you're requiring a user enable javaScript just to get
a date. And it depends upon what the date is for.
$comment = db_query("SELECT `comment`, `date` FROM `blog` WHERE 1;");
$days = floor((time() - strtotime($comment->date)) / (60 * 60 * 24));
echo "This comment was written {$days} days ago.";
This wouldn't work as expected with js's Date() across time zones.
As far as newbie questions -- I don't consider myself new to PHP at
all; yet, when dealing with time issues from all over the globe and
processing overtime pay rates based upon laws local to the employee
and to the business's main office, things got quite complicated.
Especially considering the different computers were located in
different time zones all together. It took a bit of thought and some
testing since the existant code wasn't storing things in UTC, but
relative to the local server.
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php