# Alter topic creation date

**URL:** https://meta.discourse.org/t/alter-topic-creation-date/168256
**Category:** Development
**Created:** [October 26, 2020, 8:57am UTC](https://meta.discourse.org/t/alter-topic-creation-date/168256 "2020-10-26T08:57:54Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![dariKG](https://avatars.discourse-cdn.com/v4/letter/d/c2a13f/32.png) [@dariKG](https://meta.discourse.org/u/dariKG)
#### Post date: [October 26, 2020, 8:57am UTC](https://meta.discourse.org/t/alter-topic-creation-date/168256/1 "2020-10-26T08:57:54Z")

</div>

Hi everyone,

I am writing because I am trying to populate my forum with posts made by a set of users on another old forum.

What I would like to do is to create these threads - and the subsequent posts they may have - keeping the original creation date.

Altering the “created\_at” field at POST time does not work. I am working via the API.

TL;DR If a thread made on the old forum was posted on Oct 14, '11, at 07:45 am, how do I keep the original posting date&time when importing it into a new Discourse forum?

Thank you all for your help!

D.

---

<div class="post-metadata">

### Author: ![merefield](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/merefield/32/176214_2.png) [@merefield](https://meta.discourse.org/u/merefield)
#### Post date: [October 26, 2020, 8:59am UTC](https://meta.discourse.org/t/alter-topic-creation-date/168256/2 "2020-10-26T08:59:28Z")

</div>

There are a load of example migration scripts in the core repo and some how to’s on here to exploit them - why use the API?

---

<div class="post-metadata">

### Author: ![dariKG](https://avatars.discourse-cdn.com/v4/letter/d/c2a13f/32.png) [@dariKG](https://meta.discourse.org/u/dariKG)
#### Post date: [October 26, 2020, 11:37am UTC](https://meta.discourse.org/t/alter-topic-creation-date/168256/3 "2020-10-26T11:37:11Z")

</div>

@merefield, thanks, I’ve seen some migration scripts, but for the time being, I’m using the API directly.  
I’m just wondering whether what I want to do (pre-date a thread) is even possible at all on Discourse.

---

<div class="post-metadata">

### Author: ![hawm](https://avatars.discourse-cdn.com/v4/letter/h/f07891/32.png) [@hawm](https://meta.discourse.org/u/hawm)
#### Post date: [October 26, 2020, 12:43pm UTC](https://meta.discourse.org/t/alter-topic-creation-date/168256/4 "2020-10-26T12:43:55Z")

</div>

> [@dariKG](#):
>
> Oct 14, '11, at 07:45 am

Try to passing the `created_at` variable more specific if you did not.

I just look into the Discourse source code, it using `Time.zone.parse` to parse your `created_at` date string, for your example, it result

```plaintext
pry(main)> Time.zone.parse("Oct 14, '11, at 07:45 am").to_s
=> "0011-10-14 07:45:00 UTC"

```

how about an RFC 3339 string

```plaintext
pry(main)> Time.zone.parse('2011-10-14T14:00:00-10:00').to_s
=> "2011-10-15 00:00:00 UTC"

```

---

<div class="post-metadata">

### Author: ![dariKG](https://avatars.discourse-cdn.com/v4/letter/d/c2a13f/32.png) [@dariKG](https://meta.discourse.org/u/dariKG)
#### Post date: [November 21, 2020, 9:17am UTC](https://meta.discourse.org/t/alter-topic-creation-date/168256/5 "2020-11-21T09:17:29Z")

</div>

Thank you! That did the trick 🙂
