Calculate future date

try $future_timestamp = strtotime(‘+1 week’, get_the_date(‘Y-m-d’)); echo date(‘Y-m-d’, $future_timestamp); or $future_timestamp = get_the_date(‘U’) + (60 * 60 * 24 * 7); echo date(‘Y-m-d’, $future_timestamp);

Changing “submitted on date” of comments

I presume you mean the format of the date that is displayed for the comment. Different themes will do this different ways, but in general there should be a comments.php file which should contain what makes up a comment. In here should be wp_list_comments(); You will need to add a callback in here which will … Read more

Relative time – how to calculate difference beween post publish date and current time

To print relative time on posts automatically we can use get_the_date filter. We will check the time difference and print it in human readable form. // Relative date & time function wp_relative_date() { return human_time_diff( get_the_time(‘U’), current_time( ‘timestamp’ ) ) . ‘ ago’; } add_filter( ‘get_the_date’, ‘wp_relative_date’ ); // for posts add_filter( ‘get_comment_date’, ‘wp_relative_date’ ); … Read more

wrong php date()?

This could probably make exquisite debugging session, but taking in account it’s Friday evening – just use date_i18n() instead and let WordPress deal with a huge mess that time/date issues usually are.

setlocale for date

Use date_i18n( $format, $i ); echo date_i18n(‘j F Y’, strtotime( $event_date[0] ) ) . ‘ ‘ . date_i18n(‘j F Y’, strtotime( $event_from_time[0] ) ) . ‘ do ‘ . date_i18n(‘j F Y’, strtotime( $event_to_time[0] ) ); See also: How to integrate get_post_time with date_i18n function?

I get “The PHP Date/Time library is not supported by your web host.” on my CentOS host, what library to I need to install to add support?

Upgrade to PHP 5.2 or above The Error Message you see is by WordPress. It’s very misleading what it basically saying is, that you need a PHP version >= 5.2 for that feature to work. Please look into your operating systems documentation or contact technical support on how to update your PHP version. For CentOS, … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)