# Change "Date added to library"

**URL:** <https://forums.plex.tv/t/change-date-added-to-library/627139>\
**Category:** Plex Media Server\
**Tags:** server-docker, server-qnap\
**Created:** [August 25, 2020, 4:39pm UTC](https://forums.plex.tv/t/change-date-added-to-library/627139 "2020-08-25T16:39:51Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![balli1187](https://avatars.discourse-cdn.com/v4/letter/b/a6a055/32.png) [@balli1187](https://forums.plex.tv/u/balli1187)\
**Post date:** [August 25, 2020, 4:39pm UTC](https://forums.plex.tv/t/change-date-added-to-library/627139/1 "2020-08-25T16:39:51Z")

</div>

Hi community,

I‘m using plex for movies and TV shows and now also want to move my music (from iTunes) to it.

I searched a lot but unfortunately Plex does not have an importing function (would make it a soooo much easier decision).  
Well, I will try to push meta information to ID3 Tags and then import the files…  
BUT if I do so, all songs will be shown as added on the same day.

I know that this has to be changed directly in the Database via sqliteBrowser, but which tables/fields do I have to change?  
I would like to set the date-added to the date the file was created in the file system.

Stephan

---

<div class="post-metadata">

**Author:** ![Volts](https://avatars.discourse-cdn.com/v4/letter/v/a5b964/32.png) [@Volts](https://forums.plex.tv/u/Volts)\
**Post date:** [August 25, 2020, 5:00pm UTC](https://forums.plex.tv/t/change-date-added-to-library/627139/2 "2020-08-25T17:00:11Z")

</div>

That’s interesting!

You’re looking at `metadata_items.added_at`.

You will have to do some additional joins to get from the imported files/paths, which are in `media_parts.file`, back up to the correct `metadata_items` row.

filename -\> media\_parts.file  
media\_parts.media\_item\_id -\> media\_items.id  
media\_items.metadata\_item\_id -\> metadata\_items.id  
metadata\_items.added\_at

I think. You’ll want to validate that, for sure!

How are you thinking to approach this?

For each file, pull the date from the filesystem  
Look in the database for the matching file  
Update added\_at if it isn’t already correct

?

---

<div class="post-metadata">

**Author:** ![anon18523487](https://avatars.discourse-cdn.com/v4/letter/a/49beb7/32.png) [@anon18523487](https://forums.plex.tv/u/anon18523487)\
**Post date:** [August 25, 2020, 7:39pm UTC](https://forums.plex.tv/t/change-date-added-to-library/627139/3 "2020-08-25T19:39:18Z")

</div>

You won’t be able to do this with basic SQL commands. Sqlite doesn’t have a way to identify the filesystem date of your files.

---

<div class="post-metadata">

**Author:** ![balli1187](https://avatars.discourse-cdn.com/v4/letter/b/a6a055/32.png) [@balli1187](https://forums.plex.tv/u/balli1187)\
**Post date:** [August 26, 2020, 6:24pm UTC](https://forums.plex.tv/t/change-date-added-to-library/627139/4 "2020-08-26T18:24:35Z")

</div>

Actually I don‘t really know how to do this yet.

I hoped to get some hints hear and achieve it with some basic SQL-Knowledge. What I can read from your answers it seems a lot more difficult then I thought before.

I haf a brief look at some fields of the library.  
For some test songs, I put to my plex server, it seems that `media_items.updated_at` Is the same like the Date\_modify in the file system.

Am I right with this?

---

<div class="post-metadata">

**Author:** ![anon18523487](https://avatars.discourse-cdn.com/v4/letter/a/49beb7/32.png) [@anon18523487](https://forums.plex.tv/u/anon18523487)\
**Post date:** [August 26, 2020, 6:36pm UTC](https://forums.plex.tv/t/change-date-added-to-library/627139/5 "2020-08-26T18:36:59Z")

</div>

There are 2 scenarios you need to be aware of. When creating a new library, Plex will use the file/folder dates for the added\_at date. This way you won’t have everything appear as new. However, adding additional content to the library will always use the current date for added\_at. The update\_at is similar, but that’s not really used for anything so it’s not as important.

I’ve done this for Windows, but not for QNAP. Basically I used a scripting program that can ready the file/folder dates then called individual SQL commands to update each entry in the database.

---

<div class="post-metadata">

**Author:** ![Volts](https://avatars.discourse-cdn.com/v4/letter/v/a5b964/32.png) [@Volts](https://forums.plex.tv/u/Volts)\
**Post date:** [August 26, 2020, 6:53pm UTC](https://forums.plex.tv/t/change-date-added-to-library/627139/6 "2020-08-26T18:53:06Z")

</div>

Oh that’s interesting. If updated\_at already contains the date that you want, it would be quite easy to update available\_at to that date.

Do you want to do this to all of your music?

---

<div class="post-metadata">

**Author:** ![Volts](https://avatars.discourse-cdn.com/v4/letter/v/a5b964/32.png) [@Volts](https://forums.plex.tv/u/Volts)\
**Post date:** [August 26, 2020, 6:54pm UTC](https://forums.plex.tv/t/change-date-added-to-library/627139/7 "2020-08-26T18:54:03Z")

</div>

I wasn’t aware of the special handling for “new” libraries. That’s probably your best bet if you can swing it that way.

---

<div class="post-metadata">

**Author:** ![balli1187](https://avatars.discourse-cdn.com/v4/letter/b/a6a055/32.png) [@balli1187](https://forums.plex.tv/u/balli1187)\
**Post date:** [August 26, 2020, 9:36pm UTC](https://forums.plex.tv/t/change-date-added-to-library/627139/8 "2020-08-26T21:36:06Z")

</div>

@anon18523487:  
By “file/folder dates” you mean the creation date or the update date?  
I tried to move my whole music, located on a windows PC, to my NAS with Plex running on it. This didn‘t work cause the creation date is set to the date I copied th files…  
I just copied everything, maybe it is better to put everything to a zip-file before?!

I also tried to build a new library with my iTunes xml. In this case a new database called iTunes.db was created beside my library.db  
In this I found a Field containing the dates I added the files to iTunes. This would be exactly what want to have for an “importing-from-iTunes” function but I couldn’t find a date-added-to-Plex-field I this DB.  
Where is this date stored?

---

<div class="post-metadata">

**Author:** ![anon18523487](https://avatars.discourse-cdn.com/v4/letter/a/49beb7/32.png) [@anon18523487](https://forums.plex.tv/u/anon18523487)\
**Post date:** [August 26, 2020, 10:22pm UTC](https://forums.plex.tv/t/change-date-added-to-library/627139/9 "2020-08-26T22:22:20Z")

</div>

> [@balli1187](#):
>
> By “file/folder dates” you mean the creation date or the update date?

I believe it’s the creation date but I’d have to double check.

> [@balli1187](#):
>
> In this case a new database called iTunes.db

I don’t remember this database. I think that’s a temp database. Either way, Plex doesn’t import everything and I don’t believe the import date is one of those fields used. You could use this for this project, which does make it easier.

---

<div class="post-metadata">

**Author:** ![balli1187](https://avatars.discourse-cdn.com/v4/letter/b/a6a055/32.png) [@balli1187](https://forums.plex.tv/u/balli1187)\
**Post date:** [August 28, 2020, 7:54am UTC](https://forums.plex.tv/t/change-date-added-to-library/627139/10 "2020-08-28T07:54:40Z")

</div>

> [@anon18523487](#):
>
> I believe it’s the creation date but I’d have to double check.

Could you please check this. From what i tried so far i think its not the creatione date (birth date) cause when i import my music to plex, some files older files at the beginning. Maybe i recently changed the ID3 tags at this files. so it seems plex uses Date changed/modified.

In this case i would try to export the itunes import dates and set the dates on files system befor a build the new library.  
Would you share our windows script?

> [@anon18523487](#):
>
> I don’t remember this database. I think that’s a temp database. Either way, Plex doesn’t import everything and I don’t believe the import date is one of those fields used. You could use this for this project, which does make it easier.

When i look at the timestamps, the itunes.db is not only a temporary db during library setup. In my case the last access was a few days ago but the lib setup was in June.

if i want to go with the database and manipulating the timstamps after the songs were importet in plex: Which are the right filds? is it only `metadata_items.added_at` or is it stored somewhere else?

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/plex/original/3X/2/a/2acb9765406f63293d357b4ec509ec39aa28f2ad.png) [@system](https://forums.plex.tv/u/system)\
**Post date:** [November 26, 2020, 7:55am UTC](https://forums.plex.tv/t/change-date-added-to-library/627139/11 "2020-11-26T07:55:06Z")

</div>

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.
