# SOLVED: How to add timestamp to article page

**URL:** <https://forum.ghost.org/t/solved-how-to-add-timestamp-to-article-page/31663>\
**Category:** Using Ghost\
**Created:** [July 30, 2022, 6:49am UTC](https://forum.ghost.org/t/solved-how-to-add-timestamp-to-article-page/31663 "2022-07-30T06:49:22Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Berkeley\_Scanner](https://sea1.discourse-cdn.com/flex015/user_avatar/forum.ghost.org/berkeley_scanner/32/18474_2.png) [@Berkeley\_Scanner](https://forum.ghost.org/u/Berkeley_Scanner)\
**Post date:** [July 30, 2022, 6:49am UTC](https://forum.ghost.org/t/solved-how-to-add-timestamp-to-article-page/31663/1 "2022-07-30T06:49:22Z")

</div>

I’m hoping to add a timestamp / publication time to my articles.

 ![Screen Shot 2022-07-29 at 11.36.12 PM](https://us1.discourse-cdn.com/flex015/uploads/ghost2/original/3X/2/3/232a832b36a67c45c11b984795190eaa67a4aa26.png)

I would like it to appear next to the date (and then move down reading time to the next line).

The kind folks at support directed me to this page -

> **[Ghost Handlebars Theme Helpers: date](https://ghost.org/docs/themes/helpers/date/)**
>
> Output date formats in your Ghost publication with the date helper. More about Ghost themes inside ✨

But that does not directly deal with what I need, which is the specific code to add pub time.

It **does** include the following sentence - See the [Moment.js Display tokens](https://momentjs.com/docs/#/displaying/format/) for more options. - which seems like it would offer some clues.

But that page - [Moment.js | Docs](https://momentjs.com/docs/#/displaying/as-javascript-date/) - seems to be in a completely different format from how the code in my post-meta.hbs file appears, as follows:

```auto
<div class="gh-article-meta">
            <time class="gh-article-date" datetime="{{date format="YYYY-MM-DD"}}">{{date}}</time>
        </div>

```

In the interest of not bothering the support folks again, I was hoping someone here might clarify: Do I need to completely **change the format** of all of this code if I want to add pub time? (Otherwise, idk what to make of the moment.js info.) Or is there simply some time-related code I could add to this to add pub time to what displays? If so, where can I find examples of different formatting options for that - and do I put it inside the string that includes the date, or is it separate from that?

I took a shot in the dark and tried throwing in {{time}} after date… but I didn’t get anywhere. This has all got to be spelled out somewhere but I could not find it. I’m about ready to just manually start typing in my pub time somewhere in the story…

Maybe someone who has already added timestamps can clue me in…

THANK YOU! :)

---

<div class="post-metadata">

**Author:** ![Stromfeldt](https://sea1.discourse-cdn.com/flex015/user_avatar/forum.ghost.org/stromfeldt/32/13572_2.png) [@Stromfeldt](https://forum.ghost.org/u/Stromfeldt)\
**Post date:** [July 30, 2022, 7:17am UTC](https://forum.ghost.org/t/solved-how-to-add-timestamp-to-article-page/31663/2 "2022-07-30T07:17:54Z")

</div>

I’ve never tried it myself, but I think the portion of the moment.js page you want to be looking at is this:

 ![Screen Shot 2022-07-30 at 5.11.50 pm](https://us1.discourse-cdn.com/flex015/uploads/ghost2/original/3X/2/7/27085eabd2a4d43316aad9967365b4b3f7b18eed.png)

You might want to try duplicating `{{date format="YYYY-MM-DD"}}` with something like `{{date format="h-m"}}`. Or `{{time format="h-m"}}`?. I’m guessing that if you play around with it a bit you’ll get it.

---

<div class="post-metadata">

**Author:** ![Berkeley\_Scanner](https://sea1.discourse-cdn.com/flex015/user_avatar/forum.ghost.org/berkeley_scanner/32/18474_2.png) [@Berkeley\_Scanner](https://forum.ghost.org/u/Berkeley_Scanner)\
**Post date:** [July 30, 2022, 7:29am UTC](https://forum.ghost.org/t/solved-how-to-add-timestamp-to-article-page/31663/3 "2022-07-30T07:29:22Z")

</div>

Thanks, I will do that. There’s definitely a lot of trial-and-error happening over here!

---

<div class="post-metadata">

**Author:** ![Berkeley\_Scanner](https://sea1.discourse-cdn.com/flex015/user_avatar/forum.ghost.org/berkeley_scanner/32/18474_2.png) [@Berkeley\_Scanner](https://forum.ghost.org/u/Berkeley_Scanner)\
**Post date:** [July 30, 2022, 9:18am UTC](https://forum.ghost.org/t/solved-how-to-add-timestamp-to-article-page/31663/4 "2022-07-30T09:18:35Z")

</div>

Well I underestimated the concept of “play around with it a bit.” How many hours has it been?? I really do not have a good grasp of code so I did a lot of experimenting with each element to understand what they were doing / not doing.

Here’s what ultimately produced the timestamp for me:

```auto
<time class="gh-article-date">{{date format="MMMM D, YYYY h:mm A"}}</time>

```

I had to get rid of the Ghost {{date}} helper and move the date format language into the output area. (Sorry, I don’t know the technical terms for the various pieces of this; I’ll have to read up.)

An even simpler solution is located in the following table, which is linked on the page [Ghost pointed me toward](https://momentjs.com/docs/#/displaying/format/) (although a bit more specificity may have gotten me there MUCH faster but, hey, I’ve certainly learned a lot!!).

 ![Screen Shot 2022-07-30 at 2.01.25 AM](https://us1.discourse-cdn.com/flex015/uploads/ghost2/original/3X/1/d/1d3c8bae22974d5c3554a42b2093cf911e25b236.png)

So here is the corresponding code from the table that outputs the same as the lengthier solution above.

```auto
<time class="gh-article-date">{{date format="LLL"}}</time>

```

I’ll also note that the [Ghost page re: dates](https://ghost.org/docs/themes/helpers/date/) DOES include the following sentence:

> If you call `{{date}}` without a format, it will default to a short localised format, `ll` .

This made no sense to me until I saw the table above and ultimately understood the context.

Here’s how it now looks on my site:

 ![Screen Shot 2022-07-30 at 2.02.52 AM](https://us1.discourse-cdn.com/flex015/uploads/ghost2/original/3X/f/6/f60c63f6dc1549c683822a72b6480c6a2bea9be9.png)

To make it perfect, I would figure out how to format all months in line with AP style and also find a way to format PM to “p.m.” in line with AP style — but that will have to wait for another day!

Thanks for your encouragement @Stromfeldt! I was truly **just** on the cusp of throwing in the towel but I soldiered on until the “aha” moment because of your instinct that it was extremely solvable.

I’ve never been so happy to see a timestamp in my life!
