RE: [PHP-DB] Is there a PHP equivalent of DATE_FORMAT ?

From: Date: Wed, 21 Feb 2001 04:41:56 +0000
Subject: RE: [PHP-DB] Is there a PHP equivalent of DATE_FORMAT ?
References: 1  Groups: php.db 
Request: Send a blank email to php-db+get-6810@lists.php.net to get a copy of this message
The only problem is .... I'm not starting with a Unix timestamp. The variable is passed from a form as YYYYmd (or 2001223... no leading zeros in the month or day). The PHP date function allows these characters in the string... "Y" - 4-digit year, "n" - month without leading zeros; i.e. "1" to "12" "j" - day of the month without leading zeros; i.e. "1" to "31" ... so echo date("Y-n-j") would give me the output in the right format, but I need to convert the input to a valid timestamp first. Any ideas?? Am I missing something really obvious...it's late and my brain is tired.. Thanks, Tim Wright ::::::::::::::::::::::::::::::::::::::::::: ::: ::: ::: Timothy Wright ::: ::: mailto:tim.wright@01network.com ::: ::: Digital Network Enterprises ::: ::: http://www.01network.com ::: ::: ::: ::: secure e-mail by request ::: ::: (PGP signature and/or encryption) ::: ::::::::::::::::::::::::::::::::::::::::::: > -----Original Message----- > From: dmalcolm [mailto:dmalcolm@hiwaay.net] > Sent: Tuesday, February 20, 2001 4:56 PM > To: php-db@lists.php.net > Subject: Re: [PHP-DB] Is there a PHP equivalent of DATE_FORMAT ? > > > Timothy Wright wrote: > > > Just wondering... > > > > DATE_FORMAT($datevariable, \"%Y%c%e\") works great in a query but I only > > need to list the date once on the page (as opposed to in each row of the > > query result) and I don't want to use a second query to MySQL. > The date is > > passed to the page as a variable in YYYYmd (month and day as integers) > > format. > > > > Any help greatly appreciated... > > > > Tim > > > > ::::::::::::::::::::::::::::::::::::::::::: > > ::: ::: > > ::: Timothy Wright ::: > > ::: mailto:tim.wright@01network.com ::: > > ::: Digital Network Enterprises ::: > > ::: http://www.01network.com ::: > > ::: ::: > > ::: secure e-mail by request ::: > > ::: (PGP signature and/or encryption) ::: > > ::::::::::::::::::::::::::::::::::::::::::: > > > > -- > > 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 > > Yes. Take a look at > http://www.php.net/manual/en/function.date.php > > You're Welcome > DM > > > > -- > 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 >

« previous php.db (#6810) next »