How can I display the current time? [closed]

Take a look at current_time(). Returns the blog’s current local time in the specified format. There are two named formats: ‘mysql’ for MySQL/MariaDB’s timestamp data type format (i.e. YYYY-MM-DD HH:MM:SS), and ‘timestamp’ for the Unix timestamp format (i.e. epoch). Other strings will be interpreted as PHP date formats (e.g. ‘Y-m-d’) since 3.9.0. The optional secondary … Read more

Convert a date to ISO8601 date format

Use the_time or get_the_time, which accept the same format parameters as php’s date. // assign to a variable $iso8601_date = get_the_time(‘c’); // or output directly the_time(‘c’); EDIT- converting formats with php: $date = “September 11, 2011 9:00 am”; $time = strtotime( $date ); echo date( ‘c’, $time );

How do I create a dynamically-updated copyright statement?

Here’s what I use: function oenology_copyright() { global $wpdb; $copyright_dates = $wpdb->get_results(” SELECT YEAR(min(post_date_gmt)) AS firstdate, YEAR(max(post_date_gmt)) AS lastdate FROM $wpdb->posts WHERE post_status=”publish” “); $output=””; if($copyright_dates) { $copyright = “© ” . $copyright_dates[0]->firstdate; if($copyright_dates[0]->firstdate != $copyright_dates[0]->lastdate) { $copyright .= ‘-‘ . $copyright_dates[0]->lastdate; } $output = $copyright; } return $output; } Of course, if there’s a … Read more

If else statement based on date_diff value

You can use strtotime() to convert the time to an integer, and then do a conditional. // Get the current time $now = strtotime(“now”); // Convert post’s modification time to int $postUpdated = strtotime( $post->post_modified ); // Check if 3 hours has passed, each hour is 60*60 seconds if ( $now – $postUpdated >= 3*60*60 … Read more

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