# Date Format Change FROM Date String TO Timestamp (reflected in Release Notes?)

**URL:** https://forums.plex.tv/t/date-format-change-from-date-string-to-timestamp-reflected-in-release-notes/799265
**Category:** Metadata & Adding Files
**Tags:** server-synology
**Created:** [July 1, 2022, 9:06pm UTC](https://forums.plex.tv/t/date-format-change-from-date-string-to-timestamp-reflected-in-release-notes/799265 "2022-07-01T21:06:15Z")
**Posts on this page:** 8
**Page:** 1

<div class="post-metadata">

### Author: ![jospkelly](https://sea1.discourse-cdn.com/plex/user_avatar/forums.plex.tv/jospkelly/32/308060_2.png) [@jospkelly](https://forums.plex.tv/u/jospkelly)
#### Post date: [July 1, 2022, 9:06pm UTC](https://forums.plex.tv/t/date-format-change-from-date-string-to-timestamp-reflected-in-release-notes/799265/1 "2022-07-01T21:06:15Z")

</div>

Server Version#: 1.27.1.5916  
Player Version#: 4.76.1  
Plexamp Version#: 4.2.2. (iOS)

When did the PMS Metadata for dates change from Date Strings (i.e., %Y-%m-%d %H:%M:%S) to numerical timestamps, and was that documented in the release notes of change log when the change was implemented?  
I have a Python script that interacts directly with the PMS DB file, and it references the “viewed\_at” field in the “metadata\_items\_views” table. This week, after updating PMS to 1.27.1.5916, my script returned a message indicating I had no “track listens” in June 2022.  
I knew this was untrue, and that is when I discovered that the “viewed\_at” field now contains timestamp data instead of time strings:

 ![image](https://global.discourse-cdn.com/plex/original/4X/2/6/6/266c00c49370776a28086016b98625534eebfcdd.png)

---

<div class="post-metadata">

### Author: ![anon5074910](https://avatars.discourse-cdn.com/v4/letter/a/db5fbb/32.png) [@anon5074910](https://forums.plex.tv/u/anon5074910)
#### Post date: [July 1, 2022, 9:24pm UTC](https://forums.plex.tv/t/date-format-change-from-date-string-to-timestamp-reflected-in-release-notes/799265/2 "2022-07-01T21:24:12Z")

</div>

I never seen it documented in the release notes but feel like approx 6-8 weeks ago when they started to make this change over to using epoch unix timestamp.

I’d imagine you could use something like `strftime` in your script to convert the human readable date into something you can query the db with. You can also use [https://www.epochconverter.com](https://www.epochconverter.com) if you want to just do a quick conversion.

---

<div class="post-metadata">

### Author: ![pshanew](https://sea1.discourse-cdn.com/plex/user_avatar/forums.plex.tv/pshanew/32/160555_2.png) [@pshanew](https://forums.plex.tv/u/pshanew)
#### Post date: [July 1, 2022, 9:30pm UTC](https://forums.plex.tv/t/date-format-change-from-date-string-to-timestamp-reflected-in-release-notes/799265/3 "2022-07-01T21:30:13Z")

</div>

I for one appreciated the move to Unix epochs for timestamps. I mean ASCII strings for timestamps? Really? The C++ I had to write to manipulate that into something useful was truly awful.

---

<div class="post-metadata">

### Author: ![ChuckPa](https://sea1.discourse-cdn.com/plex/user_avatar/forums.plex.tv/chuckpa/32/79710_2.png) [@ChuckPa](https://forums.plex.tv/u/ChuckPa)
#### Post date: [July 1, 2022, 10:11pm UTC](https://forums.plex.tv/t/date-format-change-from-date-string-to-timestamp-reflected-in-release-notes/799265/4 "2022-07-01T22:11:29Z")

</div>

If I may add?

When given ASCII, i used it this way:

`char *strptime(const char *s, const char *format, struct tm *tm)`

Upon return, `tm` contains time broken down using `*format`.  
You can now do whatever you want with it

Having it as native epoch time is indeed far better.

---

<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: [July 1, 2022, 10:24pm UTC](https://forums.plex.tv/t/date-format-change-from-date-string-to-timestamp-reflected-in-release-notes/799265/5 "2022-07-01T22:24:07Z")

</div>

`select datetime(viewed_at,'unixepoch') from metadata_item_views;`

`strftime('%s','YYYY-MM-DD')` to go the other way.

Many DB changes aren’t in the release notes. The database isn’t a public interface people are expected to use directly.

---

<div class="post-metadata">

### Author: ![jospkelly](https://sea1.discourse-cdn.com/plex/user_avatar/forums.plex.tv/jospkelly/32/308060_2.png) [@jospkelly](https://forums.plex.tv/u/jospkelly)
#### Post date: [August 25, 2022, 9:35pm UTC](https://forums.plex.tv/t/date-format-change-from-date-string-to-timestamp-reflected-in-release-notes/799265/6 "2022-08-25T21:35:49Z")

</div>

> [@anon5074910](#):
>
> I never seen it documented in the release notes but feel like approx 6-8 weeks ago when they started to make this change over to using epoch unix timestamp.
> 
> I’d imagine you could use something like `strftime` in your script to convert the human readable date into something you can query the db with. You can also use [https://www.epochconverter.com](https://www.epochconverter.com) if you want to just do a quick conversion.

Thanks for the recommendations. I did update my two scripts to comprehend the change.

---

<div class="post-metadata">

### Author: ![jospkelly](https://sea1.discourse-cdn.com/plex/user_avatar/forums.plex.tv/jospkelly/32/308060_2.png) [@jospkelly](https://forums.plex.tv/u/jospkelly)
#### Post date: [August 25, 2022, 9:41pm UTC](https://forums.plex.tv/t/date-format-change-from-date-string-to-timestamp-reflected-in-release-notes/799265/7 "2022-08-25T21:41:16Z")

</div>

> [@ChuckPa](#):
>
> If I may add?
> 
> When given ASCII, i used it this way:
> 
> `char *strptime(const char *s, const char *format, struct tm *tm)`
> 
> Upon return, `tm` contains time broken down using `*format`.  
> You can now do whatever you want with it
> 
> Having it as native epoch time is indeed far better.

Thanks Chuck. I agree that having the epoch time is better. The change just caught me by surprise.

---

<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 23, 2022, 9:41pm UTC](https://forums.plex.tv/t/date-format-change-from-date-string-to-timestamp-reflected-in-release-notes/799265/8 "2022-11-23T21:41:37Z")

</div>

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