• Resolved binyanim

    (@binyanim)


    Hi,

    I have a field for “date” in a pod called “event”
    When outputting the date using $mypod->field( 'event_date' ); I always get the same result like so: 2018-11-25 19:30:00

    This is consistent, and changing the format in the Pods menu doesn’t change it, also in the WordPress settings page.

    How can I output different time format?

    Thank you so much

Viewing 2 replies - 1 through 2 (of 2 total)
  • Thread Starter binyanim

    (@binyanim)

    Sorry again , resolved this real quick !
    Just added a function to functions.php:

    function my_date($input_date) {
        if ($input_date)
         {return date("d/m/Y", strtotime($input_date));  } 
         else {
          return;
         }
       }
    
    function my_time($input_date) {
        if ($input_date)
         {return date("G:i", strtotime($input_date));  } 
         else {
          return;
         }
       }
    Plugin Author Jim True

    (@jimtrue)

    Also if you use display instead of field you’ll get the display style you intended. Field is for the actual field value in a format that you can do something with it.

    https://pods.io/docs/code/pods/display/

    Good solution, though 😉

    • This reply was modified 5 years, 4 months ago by Jim True. Reason: added link to display docs
Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Pods time format output’ is closed to new replies.