RE: [PHP-DB] I`m having a little trouble displaying future dates...
| From: | Jeroen ten Berge | Date: | Wed, 11 Oct 2000 11:29:54 +0000 |
| Subject: | RE: [PHP-DB] I`m having a little trouble displaying future dates... | ||
| References: | 1 | Groups: | php.db |
| Request: | Send a blank email to php-db+get-3518@lists.php.net to get a copy of this message | ||
Instead of using DATE_ADD which is an SQL timestamp you're better of using
PHP internal time tools;
use time() for the current timestamp (UNIX stamp e.g. seconds since 1970 or
something);
So try this :
$NewDate=time()+(60*60*24);
So $NewDate contains the current date + 1 day;
Now go to php.net and look at the date functions there, I'm sure there's a
function which can set the time on the timestamp to 7:00 AM.
-----Original Message-----
From: Trond Erling Hundal [mailto:webmaster@port-industry.com]
Sent: Wednesday, October 11, 2000 12:30 PM
To: PHP-DB-LIST
Subject: [PHP-DB] I`m having a little trouble displaying future dates...
I`m woriking with a db of articles for a news-site, and the reporters want
to be able to manipulate the dates to store as todays-date + 1-7 day(s).
This way they can write articles in the weekend and holidays, and they won`t
be published until it`s a normal work-day again...
They also want the time to be exactly 07:00:00.
At first i used ADD_DATE(NOW(), INTERVAL 1 DAY), but this ment that if they
wrote the article on an saturday evening at, say 18:35, the article wasn`t
published until 18:35 in the evening (on the desired date)
In the form where they write their articles and select the date, I have now
tried this:
<SELECT name=\"date\">
<option value=\"DATE_ADD(CURRENT_DATE(), INTERVAL 1 DAY)\">Todays date + 1
day</option>
etc through 7...
And in the input script i had: {$date = "$date 07:00:00" ;} before I toss it
into the MySQL table.
But it only stores as 0000-00-00 00:00:00. I suppose it has something to do
with my format.
How can I solve this?
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: php-db-unsubscribe@lists.php.net
For additional commands, e-mail: php-db-help@lists.php.net
To contact the list administrators, e-mail: php-list-admin@lists.php.net