By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
440,230 Members | 2,436 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 440,230 IT Pros & Developers. It's quick & easy.

Having problems with displaying date

P: n/a
Hi everyone,
I'm having problems displaying a date in the correct format and I was
wondering if anyone knew how to help.

I'm using pear to extract a date from our back end database (the date
is in DATE_FORMAT_ISO_EXTENDED), and I was to display the date in
"Wednesday, February 23rd 2005, 11:04" format.

I'm using something like:

<?php

$x = new Date();
$x->setDate( $DateTime_text); // $DateTime_text is from pear

$x->format( D ); // This doesn't work!

echo "$x<br>";

?>

I've tried $x->format( %D ); but this gives a Parse error, saying that
it found "an unexpected '%', expecting ')'".

I've tried introducing quotation marks into the format function, even
escaping them, but nothing works. Can anyone help please?

Many thanks

Paul
--
http://www.paullee.com

Jul 17 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a
pa**@paullee.com wrote:
$x->format( D ); // This doesn't work!


I haven't used PEAR before, but I'm guessing you should be supplying a
string to this function.

Try "$x->format( 'D' );" or "$x->format( '%D' );"

--
phil [dot] ronan @ virgin [dot] net
http://vzone.virgin.net/phil.ronan/
Jul 17 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.