note 34685 deleted from function.explode by didou

From: Date: Mon, 04 Aug 2003 05:42:08 +0000
Subject: note 34685 deleted from function.explode by didou
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-53290@lists.php.net to get a copy of this message
Note Submitter: www.visfx.net ---- So, I had a little problem. I've got some dates, in mysql date format, for example, 1969-12-31. I wanted them to be in US format, for example, 12/31/1969. So you know what I did? I wrote a little script, using explode(), that will do it for you. My PHP might be a little sloppy for your standards, but here she is: function convert_date($var) { $elements = explode("-", $var); $elements[0] = $year; $elements[1] = $month; $elements[2] = $day; $date = $month . "/" . $day . "/" . $year; return $date; } and there you have it. :)

« previous php.notes (#53290) next »