Stephen,

If this date format is coming from a MySQL database (frequently the case),
you might want to look at the date formatting functions of MySQL.
http://www.mysql.com/doc/D/a/Date_and_time_functions.html.  

ex. select DATE_FORMAT('1997-10-04 22:23:00', '%W %M %Y');

One drawback is that this is not standard SQL, so it's not too portable, if
you are concerned with that.

-Ben

-----Original Message-----
From: Stephan Ahonen [mailto:[EMAIL PROTECTED]]
Sent: Monday, January 29, 2001 5:22 PM
To: [EMAIL PROTECTED]
Subject: Re: [PHP] Problem!


<<1.
$date = "20010101";

How could I output 01 01 2001 (or make it 3 variables, like day, month,
year)?>>

$year = substr($date,0,4);
$month = substr($date,4,2);
$day = substr($date,6,2);

...Assuming that the date is stored in yyyymmdd format.


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to