New answers tagged


Have you looked into expire plugins ? finally seems to have done the job.


The correct function to use for what you describe would be date_i18n() WordPress function. It will produce output that is correct for timezone configured in WordPress and also localized if necessary.


To get date, time from the timestamp you can use echo date('h:m:s d-m-Y',141234567890); This will give you the output 11:03:02 06-03-1954


found WP built-in function get_date_from_gmt : get_date_from_gmt('13:49:18 26/05/2016') or get_date_from_gmt(strtotime('13:49:18 26/05/2016'))


Just use date_i18n in multiple places with PHP date arguments just for what you need: if ( $date = get_post_meta( $thepostid, '_sale_price_dates_to', true ) ) { $sale_price_dates_to = '<span class="m">' . date_i18n( 'M', $date ) . '</span> ' . '<span class="d">' . date_i18n( 'j', $date ) . '</span> ' . ...


Loosely what you have should work already. However few things are off. Calling these function without time format will produce values like 1:36 pm (depending on your site's settings), which are not exactly comparable. Post modified time can be less than published in some cases, like scheduled posts. So I would write it along the lines of: if ( ...

Top 50 recent answers are included