Skip to content
Advertisement

Query post types based on timestamp

So I have a method where I’m setting a value in the database as a timestamp, so this property:

JavaScript

Sets the following timestamp for example 1605047781, which is GMT: Tuesday, November 10, 2020 10:36:21 PM (So 7 days from today).

What I’m attempting to achieve:

I have the following WP_Query that queries through my profile post type, and looks for all the azure_picture_expiration and azure_picture_big_expiration values.

How could I query through and pull in all profiles that will expire in 2 days? Is it possible to query through and pull profiles that will expire within 2 days?

Here is my query:

JavaScript

All help would be appreciated, I don’t have the compare filled in, because I wasn’t sure how to determine the time.

Advertisement

Answer

This seemed to work, please let me know if you have a better method:

JavaScript
User contributions licensed under: CC BY-SA
6 People found this is helpful
Advertisement