Calculate how much time passed comparing WordPress comment and current time

Yes, you can do that using PHP. Here’s a function from @arnorhs: $time = strtotime(‘2010-04-28 17:25:43’); echo ‘event happened ‘.humanTiming($time).’ ago’; function humanTiming ($time) { $time = time() – $time; // to get the time since that moment $time = ($time<1)? 1 : $time; $tokens = array ( 31536000 => ‘year’, 2592000 => ‘month’, 604800 … Read more

How to add a timestamp to the exported WXR filename?

I don’t think you need to do that, it’s already there (if I understand the question correctly): In the WXR file we get a timestamp like: that’s generated with: <?php the_generator( ‘export’ ); ?> that calls get_the_generator() where the export case is: $gen = ‘<!– generator=”WordPress/’ . get_bloginfo_rss(‘version’) . ‘” created=”‘. date(‘Y-m-d H:i’) . ‘” … Read more

How to get Unix Local Time?

Please use DateTime::getTimestamp() that returns unix timestamp. If you want to format the date according to your time zone then you try this. $datetime = new DateTime(“now”, new DateTimeZone(‘America/New York’)); echo $datetime ->format(‘m/d/Y, H:i:s’);

Update existing post times to random times?

This is the part that is responsible for random date: //* Generate a random date between January 1st, 2015 and now $random_date = mt_rand( strtotime( ‘1 January 2015’ ), time() ); So you need to change it. And if you want to randomize only the time part, then this is one way to achieve that: … Read more

Count time from registration date to today

Just gave an example of how to do it: $today_date = new DateTime( date( ‘Y-m-d’, strtotime( ‘today’ ) ) ); $register_date = get_the_author_meta( ‘user_registered’, get_current_user_id() ); $registered = new DateTime( date( ‘Y-m-d’, strtotime( $register_date ) ) ); $interval_date = $today_date->diff( $registered ); if( $interval_date->days < 31 ) { echo ‘With us ‘ . $interval_date->format(‘%d days’); … Read more

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