Ghost Tips & Tricks #1 / Show Publish Date in the day time with AM and PM format

Hello everyone,

This is the first issue of Ghost Tips & Tricks. I will be happy to share with you some practical Ghost tips that I find useful. Brought to you by Aspire Themes.


Today, I want to share with you how to format and show the post Publish Date in the day time with AM and PM format.

If you noticed in some news websites you will see that besides the published date they also show which hour of the day the post published. This is useful for the reader to know exactly what time this post was published.

Let’s take an example and see how it works.

{{ date published_at format='h:mm A' }}

In this example, we passed the format filter to the published_at property. The h in the format filter means hour, the mm means minutes and A means AM or PM. This example will give the following result.

10:02 PM

If we want to show AM or PM in a lower case format. We can use a instead of A like the following example.

{{ date published_at format='h:mm a' }}
10:02 pm

If we want to combine this with the regular date format, we can use something like the following.

{{ date published_at }} - {{ date published_at format='h:mm A' }}

The result will be.

Mar 25, 2020 - 10:02 PM

That’s it for today and I hope you find this useful…


A few days ago I started a Ghost Websites Inspiration series where share inspiring websites created with Ghost. I hope you can find it inspiring and useful too.


Stay safe!

Ahmad

5 Likes

Thanks for sharing this tip!

1 Like

My pleasure!

1 Like

Nice tip! Thanks!

1 Like

I’m glad to hear that, thank you!

very good thing!! Thanks for sharing

1 Like

Thank you!

1 Like