datetime picker, timestamps and meta queries

WordPress sets the php timezone to UTC for internal calculations. So at 4pm PST, date() will be producing a date that reads 10pm UTC. Hence the event is considered past.

There are two ways to resolve this.

  1. (The preferred method) Store dates in the database in UTC. Handle all date calculations in UTC, and convert to the desired timezone on output (frontend and back).

  2. Use date_i18n()for creating the date to query (as this will set the date according to your blog timezone).