• Resolved girlgold

    (@girlgold)


    Hi there!

    I’m trying to display postings that have a deadline past the current datetime (so, avoid showing past postings). I know how to display the posts past the current date:

    [pods name="job" template="Job Listings" orderby="deadline" where="CAST(deadline.meta_value as DATE) BETWEEN CURDATE() and '2023/01/01'"]

    And this is what I was trying to get the posts past the current datetime:

    [pods name="job" template="Job Listings" orderby="deadline" where="deadline.meta_value BETWEEN CURRENT_TIMESTAMP() and '2023-01-01 11:59:59'"]

    I thought I might not have to cast the value because I’m working with the raw data…but is this correct? Anyway, if you could let me know where I’m going wrong with my query that would be awesome.

    Thanks so much! I love your plugin by the way, it’s been super fun to work with.

    Have a great day!

    Leanne

    The page I need help with: [log in to see the link]

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author Jory Hogeveen

    (@keraweb)

    I thought I might not have to cast the value because I’m working with the raw data…but is this correct?

    Nope, I think casting as a date value should work.
    Please take a look at the MYSQL manual: https://dev.mysql.com/doc/refman/8.0/en/date-and-time-functions.html

    Cheers, Jory

    Thread Starter girlgold

    (@girlgold)

    Thanks for your response. I’ve worked with a few variations of this shortcode and the query in it:

    [pods name="job" template="Job Listings" orderby="deadline" where="CAST(deadline.meta_value as DATE) BETWEEN CURRENT_TIMESTAMP() and '12-22-2029 11:59:59'"]

    Currently it doesn’t return the data it should be bringing back. Sorry, would you be able to give a bit more guidance as to where I’m going wrong? I’ve checked out the MYSQL functions for datetime queries, and I’m not sure where this is falling through.

    Thanks!

    Plugin Author Jory Hogeveen

    (@keraweb)

    Could you show the SQL it generates?
    You can find it using Query Monitor.

    Cheers, Jory

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Show Posts After Datetime’ is closed to new replies.