note 81874 added to function.abs

From: Date: Mon, 17 Mar 2008 16:03:09 +0000
Subject: note 81874 added to function.abs
Groups: php.notes 
Request: Send a blank email to php-notes+get-137137@lists.php.net to get a copy of this message
Here is an easy MySQL way of getting the difference in dates. For me it is more logical to do this on the select than running it though an additional php function after selecting the date. But depends on what your doing of course. I hope it helps. SELECT ABS(DATEDIFF(NOW(),your_date_field)) as days_ago ---- Server IP: 209.41.74.194 Probable Submitter: 74.93.182.242 ---- Manual Page -- http://www.php.net/manual/en/function.abs.php Edit -- https://master.php.net/note/edit/81874 Del: integrated -- https://master.php.net/note/delete/81874/integrated Del: useless -- https://master.php.net/note/delete/81874/useless Del: bad code -- https://master.php.net/note/delete/81874/bad+code Del: spam -- https://master.php.net/note/delete/81874/spam Del: non-english -- https://master.php.net/note/delete/81874/non-english Del: in docs -- https://master.php.net/note/delete/81874/in+docs Del: other reasons-- https://master.php.net/note/delete/81874 Reject -- https://master.php.net/note/reject/81874 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#137137) next »