1. Home
  2. How To
  3. How to Modify Date or Change Date Format in AMP

How to Modify Date or Change Date Format in AMP

Hello Guys, In this tutorial I’ll be showing you how to change the Date format in AMP, Using the filter.

Let’s get down to it.

#1. Modifying via Filter

You need to add the following filter code into your theme’s functions.php file at the end of the code or create a custom plugin and add the following code.

By doing the above-mentioned changes you’ve changed the date format, or you can get the desired format by playing with the ampforwp_modify_date_index() function code.

#2. Using amp_date() function

How to change date in amp wordpress

If you have created a custom template and used the function amp_date() and want to change the date, then you can pass an array like shown below.

Example:

We use Date() function to show the date and all the compatible date formats are supported by amp_date() function. Here is the list of all the available date types here.

If you have any queries regarding this feel free to ask.

And don’t forget to leave the feedback if it helps you.

Updated on March 13, 2018

Was this article helpful?

Related Articles

Comments

  1. I do not want to show sate on homepage in the free version in the third design template. I want to completely remove date. The single posts dont show date in meta but the homepage shows like 1 year ago, 11 months ago. Please guide me how to remove it.

  2. Hi there,

    I have inserted this code into functions.php but for Design 1 it still shows human readable time. I looked into the code for design 1 and it seems hardcoded. Is there any way around this? Thanks!

Add A Comment