RE: [PHP-ES] truncar cadena de texto
| From: | claudio martinez santiago | Date: | Wed, 24 Dec 2003 11:38:22 +0000 |
| Subject: | RE: [PHP-ES] truncar cadena de texto | ||
| Groups: | php.general.es | ||
| Request: | Send a blank email to general-es+get-43977@lists.php.net to get a copy of this message | ||
Una forma puede ser con substr
$fecha="20031224";
$anyo=substr($fecha,0,4);
$mes=substr($fecha,4,2);
$dia=substr($fecha,6,2);
y si la tienes desde mysql
$fecha="2003-12-24";
$re=explode("-",$fecha);
echo $re[0]; // año
echo $re[1]; // mes
echo $re[2]; // dia
bueno supongo que es asi no lo he probado
saludos y feliz navidad
claudio
From: <marolijo@yahoo.es> Reply-To: lista@phpes.com To: "Lista@Phpes.Com" <lista@phpes.com> Subject: [PHP-ES] truncar cadena de texto Date: Wed, 24 Dec 2003 10:45:00 +0100 Hola, recibo por GET una fecha del tipo 20031224 cómo puedo separar los valores de año mes i dia? gracias por su tiempo __________________________________________________ PolNetwork.com Pol Maresma i Oliveras pol@polnetwork.com - webmaster@santpol.org Creació, manteniment i allotjament de pàgines Web __________________________________________________ PRIVAT I CONFIDENCIAL - Aquest missatge i els document adjunts que pugui contenir són confidencials. Si no sou el destinatari del missatge no teniu permís per llegir-lo, copiar-lo ni reenviar-lo. Si heu rebut aquest missatge per error, siusplau comuniqueu-ho al remitent retornant el missatge i esborreu les còpies del missatge i els seus documents adjunts. Aquest avís no pot ser eliminat. PRIVATE & CONFIDENTIAL - This email message and attachments contain information that is confidential. If you are not the intended recipient, you are not permitted to use, copy or distribute the message and attachments in any manner. If you have received this email in error, please inform the sender by return email immediately and delete all copies of the message and its attachments. This notice should not be removed. __________________________________________________ --------------------------------------------------------------------- Archivo On-line: http://www.phpes.com/ via news: news://news.phpes.com/ Manual PHP en español: http://www.php.net/manual/es/ Para dar de baja la suscripción, mande un mensaje a: lista-unsubscribe@phpes.com_________________________________________________________________ Reserva y planifica tu viaje online. http://www.msn.es/Viajes/