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

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:

1 Like

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 if you want to just do a quick conversion.

2 Likes

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.

2 Likes

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.

3 Likes

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.

3 Likes

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

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

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