0

I'm using a page builder on my Wordpress site which allows editing of the PHP. On a page I wanted to add a custom field which shows an expiry date set by a plugin.

I did this by adding:

<?php echo do_shortcode("[oxygen data='meta' key='_expiration-date']"); ?>

This works, but the date and time returned is in a Unix format(?) so it looks like: 1538329800

Is there a way to convert this number to a proper text output to be displayed on pages?

  • 2
    Possible duplicate of [Converting a UNIX Timestamp to Formatted Date String](https://stackoverflow.com/questions/10040291/converting-a-unix-timestamp-to-formatted-date-string) – Andreas Sep 30 '18 at 07:12

2 Answers2

0

Try the following

<?php echo date("d/m/Y",do_shortcode("[oxygen data='meta' key='_expiration-date']")); ?>

Hope it works for you.

Piyush Bansal
  • 1,635
  • 4
  • 16
  • 39
0

Use This (I included time as well if you want that too0

echo date("d-m-Y h:i:sa", do_shortcode("[oxygen data='meta' key='_expiration-date']"));
Mason Stedman
  • 613
  • 5
  • 12