Custom Fields
Re-Envisioned
Support General Date format in PHP not working for me

This topic contains 0 replies, has 1 voice, and was last updated by  John Anderson 3 months ago.

  • Creator
    Topic
  • #15405

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

You must be logged in to reply to this topic.