How to get year, month and hour in WordPress?

PHP Date Format in WordPress function: You’ll have to use the proper date format string (as used in PHP date function) in the WordPress get_the_date() function’s first parameter. For example, to get the Date & Time in the format like 2018-07-23 23:59 (i.e. YYYY-MM-DD HH:MM, where hour is in 24 hour format), you need CODE … Read more

Date, Time, and Timezones

What is the purpose of the timezone setting in the Admin -> Settings section? Since WordPress handles time zone on its own (separately from native PHP functionality) that is where the setting made and result is stored in options. Whenever anything that works with timezones needs to happen, the time zone setting is retrieved and … Read more

ACF datepicker meta_query Compare Dates in m/d/Y g:i a – Not in Ymd Format

There should not be any need to do this. Even if an ACF Field is using ‘return_format’ => ‘m/d/Y g:i a’, The post_meta value is in YYYY-MM-DD 00:00:00 format. $date_now = date(‘Y-m-d’); $args = [ ‘meta_key’=>’the_date’, ‘meta_value’=>$date_now.’ 00:00:00′, ‘meta_compare’=>’>=’, ]; $query = new WP_Query( $args ); Edit: I’ve noticed some discrepancies in this, the value … Read more