Date format in PHP not working for me

Support General Date format in PHP not working for me

Viewing 1 post (of 1 total)
  • Author
    Posts
  • #15405
    John AndersonJohn Anderson
    Participant

    Hello,
    I have a CPT field called fish_datefirstsighted. It is a date field. When I display this using

    <?php
        $value = rwmb_get_value( 'recapture_dateofsighting' );
        echo $value;
    ?>

    I get: '2019-5-7' which represents 7th day of May 2019.

    When I format as follows, I get 1 January, 1970.

    <?php
        $value = rwmb_get_value( 'recapture_dateofsighting' );
        echo date( 'j F, Y', $value );
    ?>

    I know this result means there is a date translation error but I don't know how to resolve this.

    Can anyone offer a suggestion?
    Thanks,

    John.

Viewing 1 post (of 1 total)
  • You must be logged in to reply to this topic.