Having problems with displaying date

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • paul@paullee.com

    Having problems with displaying date

    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
    --


  • Philip Ronan

    #2
    Re: Having problems with displaying date

    paul@paullee.co m wrote:
    [color=blue]
    > $x->format( D ); // This doesn't work![/color]

    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



    Comment

    Working...