Re: Urgent coding help

From: Date: Fri, 20 Oct 2000 06:37:56 +0000
Subject: Re: Urgent coding help
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-21340@lists.php.net to get a copy of this message
On Fri, Oct 20, 2000 at 08:24:10AM +0200, Slaven Vujic wrote: > > Hi, > > I hope someone will offer a prompt solution in this. > > I have a news managment on my site. > > Table news: > id smallint (5) zerofill not null auto_increment, > title varchar(255), > text blob, > date varchar(10), > image varchar(12), > hour char(5), > autor_id char(3) > > The news are submited almost always with current date and time, but user can specify some other > time or date for specific news to show up on webpage. > > Date is submited in format: 20-10-2000 > Hour is submited in format: 14:45 > > On webpage I get the hour and date in specific code and then I compare them with hours and > dates inserted in MySQL table. > > If the user specify some future date or time, how can I make the PHP code to display that news > exactly on time that has been set manually by the user? The easiest way to deal with this issue, imo, is to make an input form for the date comprised of drop-down boxes for day, month and year. This way, you get the date in a known format and can easily convert it to whatever you need. btw: for dates, you should be using the DATE type, or TIMESTAMP. By using varchar you will make it much harder to do date operations like the above. HTH, Mike -- Mike Erickson <mee@quidquam> http://www.quidquam.com/ "Hatred is the coward's revenge for being intimidated" - George Bernard Shaw

« previous php.general (#21340) next »