Date Display as F j, Y instead of yyyy-mm-dd

Support MB Views Date Display as F j, Y instead of yyyy-mm-ddResolved

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #33640
    greatachillesgreatachilles
    Participant

    Hi

    We use the following code in a Meta Box view to display the date of a post:

    <span><strong>Publication Date:</strong> {{ mb.get_post_meta( post.ID, 'date_created', true ) }}</span>

    However, while it displays the date, it doesn't display it correctly.

    WordPress settings have the Date Format as F j, Y. However, rather than displaying the date as F j, Y like we want, the Meta Box view shows yyy-mm-dd.

    Here is an example page: https://thedockforlearning.org/series/introduction-to-diverse-learners/?swcfpc=1

    How can we make Meta Box display the date formatted correctly?

    #33686
    Long NguyenLong Nguyen
    Moderator

    Hi,

    You can use the date filter in View, like this

    {{ mb.get_post_meta( post.ID, 'date_created', true ) | date( 'Y-m-d' ) }}

    Refer to this documentation https://twig.symfony.com/doc/3.x/filters/date.html

Viewing 2 posts - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.