Re: looong date formatting for MySQL

From: Date: Fri, 17 Aug 2001 23:29:42 +0000
Subject: Re: looong date formatting for MySQL
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-63252@lists.php.net to get a copy of this message
Thanks for the reply, however, that function call doesn't zero-substitute (i.e., "07" for "7", "03" for "3", etc.); that's why I've added this: if ($month < 10) { $month = "0"; $month .= $today['mon']; } By default, MySQL only accepts dates as YYYY-MM-DD; PHP's getdate(Y-m-d) prints out YYYY-M-DD or YYYY-MM-DD IF AND ONLY IF the month is two-digit. --- Adam Rambousek <rambousek@volny.cz> wrote: > date("Y-m-d") should do the job > > > There's gotta be an easier way to get create a > date > > properly formatted for MySQL's standard YYYY-MM-DD > > DATE field format. Any suggestions, > > smacks-upside-the-head, etc. on how to reduce this > > would be greatly appreciated. > > > > -- > Adam Rambousek > email: rambousek@volny.cz ICQ: 47596279 > Jabber: rambousek@njs.netlab.cz > www: http://adamovy.cestiny.cz > http://hemzeni.poda.cz/matrix > * I'll save you from yourself, From those demons of > the night > They promise fame and fortune, All that you > eagerly desire. - Era > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, e-mail: > php-general-unsubscribe@lists.php.net > For additional commands, e-mail: > php-general-help@lists.php.net > To contact the list administrators, e-mail: > php-list-admin@lists.php.net > __________________________________________________ Do You Yahoo!? Make international calls for as low as $.04/minute with Yahoo! Messenger http://phonecard.yahoo.com/

« previous php.general (#63252) next »