current_time example


function wp_insert_comment( $commentdata ) {
    global $wpdb;

    $data = wp_unslash( $commentdata );

    $comment_author       = ! isset( $data['comment_author'] ) ? '' : $data['comment_author'];
    $comment_author_email = ! isset( $data['comment_author_email'] ) ? '' : $data['comment_author_email'];
    $comment_author_url   = ! isset( $data['comment_author_url'] ) ? '' : $data['comment_author_url'];
    $comment_author_ip    = ! isset( $data['comment_author_IP'] ) ? '' : $data['comment_author_IP'];

    $comment_date     = ! isset( $data['comment_date'] ) ? current_time( 'mysql' ) : $data['comment_date'];
    $comment_date_gmt = ! isset( $data['comment_date_gmt'] ) ? get_gmt_from_date( $comment_date ) : $data['comment_date_gmt'];

    $comment_post_id  = ! isset( $data['comment_post_ID'] ) ? 0 : $data['comment_post_ID'];
    $comment_content  = ! isset( $data['comment_content'] ) ? '' : $data['comment_content'];
    $comment_karma    = ! isset( $data['comment_karma'] ) ? 0 : $data['comment_karma'];
    $comment_approved = ! isset( $data['comment_approved'] ) ? 1 : $data['comment_approved'];
    $comment_agent    = ! isset( $data['comment_agent'] ) ? '' : $data['comment_agent'];
    $comment_type     = empty( $data['comment_type'] ) ? 'comment' : $data['comment_type'];
    $comment_parent   = ! isset( $data['comment_parent'] ) ? 0 : $data['comment_parent'];

    $user_id = ! isset( $data['user_id'] ) ? 0 : $data['user_id'];

    

    $meta = apply_filters( 'signup_site_meta', $meta$domain$path$title$user$user_email$key );

    $wpdb->insert(
        $wpdb->signups,
        array(
            'domain'         => $domain,
            'path'           => $path,
            'title'          => $title,
            'user_login'     => $user,
            'user_email'     => $user_email,
            'registered'     => current_time( 'mysql', true ),
            'activation_key' => $key,
            'meta'           => serialize( $meta ),
        )
    );

    /** * Fires after site signup information has been written to the database. * * @since 4.4.0 * * @param string $domain The requested domain. * @param string $path The requested path. * @param string $title The requested site title. * @param string $user The user's requested login name. * @param string $user_email The user's email address. * @param string $key The user's activation key. * @param array $meta Signup meta data. By default, contains the requested privacy setting and lang_id. */
<?php $wp_list_table->views(); ?> <form id="comments-form" method="get"> <?php $wp_list_table->search_box( __( 'Search Comments' ), 'comment' ); ?> <?php if ( $post_id ) : ?> <input type="hidden" name="p" value="<?php echo esc_attr( (int) $post_id ); ?>" /> <?php endif; ?> <input type="hidden" name="comment_status" value="<?php echo esc_attr( $comment_status ); ?>" /> <input type="hidden" name="pagegen_timestamp" value="<?php echo esc_attr( current_time( 'mysql', 1 ) ); ?>" /> <input type="hidden" name="_total" value="<?php echo esc_attr( $wp_list_table->get_pagination_arg( 'total_items' ) ); ?>" /> <input type="hidden" name="_per_page" value="<?php echo esc_attr( $wp_list_table->get_pagination_arg( 'per_page' ) ); ?>" /> <input type="hidden" name="_page" value="<?php echo esc_attr( $wp_list_table->get_pagination_arg( 'page' ) ); ?>" /> <?php if ( isset( $_REQUEST['paged'] ) ) { ?> <input type="hidden" name="paged" value="<?php echo esc_attr( absint( $_REQUEST['paged'] ) ); ?>" /> <?php } ?> <?php $wp_list_table->display(); ?> </form> </div> <div id="ajax-response"></div>
$current_site            = new stdClass();
        $current_site->domain    = $domain;
        $current_site->path      = $path;
        $current_site->site_name = ucfirst( $domain );
        $wpdb->insert(
            $wpdb->blogs,
            array(
                'site_id'    => $network_id,
                'blog_id'    => 1,
                'domain'     => $domain,
                'path'       => $path,
                'registered' => current_time( 'mysql' ),
            )
        );
        $current_site->blog_id = $wpdb->insert_id;

        $site_user_id = (int) $wpdb->get_var(
            $wpdb->prepare(
                "SELECT meta_value FROM $wpdb->sitemeta WHERE meta_key = %s AND site_id = %d",
                'admin_user_id',
                $network_id
            )
require_once ABSPATH . WPINC . '/ms-site.php';
require_once ABSPATH . WPINC . '/ms-network.php';

/** * Updates the last_updated field for the current site. * * @since MU (3.0.0) */
function wpmu_update_blogs_date() {
    $site_id = get_current_blog_id();

    update_blog_details( $site_id, array( 'last_updated' => current_time( 'mysql', true ) ) );
    /** * Fires after the blog details are updated. * * @since MU (3.0.0) * * @param int $blog_id Site ID. */
    do_action( 'wpmu_blog_updated', $site_id );
}

/** * Gets a full site URL, given a site ID. * * @since MU (3.0.0) * * @param int $blog_id Site ID. * @return string Full site URL if found. Empty string if not. */

                array(
                    'name'  => _x( 'For site', 'website name' ),
                    'value' => get_bloginfo( 'name' ),
                ),
                array(
                    'name'  => _x( 'At URL', 'website URL' ),
                    'value' => get_bloginfo( 'url' ),
                ),
                array(
                    'name'  => _x( 'On', 'date/time' ),
                    'value' => current_time( 'mysql' ),
                ),
            ),
        ),
    );

    // And now, all the Groups.     $groups = get_post_meta( $request_id, '_export_data_grouped', true );
    if ( is_array( $groups ) ) {
        // Merge in the special "About" group.         $groups       = array_merge( array( 'about' => $about_group )$groups );
        $groups_count = count( $groups );
    }

function media_handle_upload( $file_id$post_id$post_data = array()$overrides = array( 'test_form' => false ) ) {
    $time = current_time( 'mysql' );
    $post = get_post( $post_id );

    if ( $post ) {
        // The post date doesn't usually matter for pages, so don't backdate this upload.         if ( 'page' !== $post->post_type && substr( $post->post_date, 0, 4 ) > 0 ) {
            $time = $post->post_date;
        }
    }

    $file = wp_handle_upload( $_FILES[ $file_id ]$overrides$time );

    

function date_i18n( $format$timestamp_with_offset = false, $gmt = false ) {
    $timestamp = $timestamp_with_offset;

    // If timestamp is omitted it should be current time (summed with offset, unless `$gmt` is true).     if ( ! is_numeric( $timestamp ) ) {
        // phpcs:ignore WordPress.DateTime.CurrentTimeTimestamp.Requested         $timestamp = current_time( 'timestamp', $gmt );
    }

    /* * This is a legacy implementation quirk that the returned timestamp is also with offset. * Ideally this function should never be used to produce a timestamp. */
    if ( 'U' === $format ) {
        $date = $timestamp;
    } elseif ( $gmt && false === $timestamp_with_offset ) { // Current time in UTC.         $date = wp_date( $format, null, new DateTimeZone( 'UTC' ) );
    } elseif ( false === $timestamp_with_offset ) { // Current time in site's timezone.
$stamp = __( 'Publish on: %s' );
            }
            $date = sprintf(
                $date_string,
                date_i18n( $date_formatstrtotime( $post->post_date ) ),
                date_i18n( $time_formatstrtotime( $post->post_date ) )
            );
        } else { // Draft (no saves, and thus no date specified).             $stamp = __( 'Publish <b>immediately</b>' );
            $date  = sprintf(
                $date_string,
                date_i18n( $date_formatstrtotime( current_time( 'mysql' ) ) ),
                date_i18n( $time_formatstrtotime( current_time( 'mysql' ) ) )
            );
        }

        if ( ! empty( $args['args']['revisions_count'] ) ) :
            ?> <div class="misc-pub-section misc-pub-revisions"> <?php                 /* translators: Post revisions heading. %s: The number of available revisions. */
                printf( __( 'Revisions: %s' ), '<b>' . number_format_i18n( $args['args']['revisions_count'] ) . '</b>' );
                ?>
// Skip updating setting params if unchanged (ensuring the user_id is not overwritten).                 if ( $data[ $changeset_setting_id ] === $merged_setting_params ) {
                    continue;
                }

                $data[ $changeset_setting_id ] = array_merge(
                    $merged_setting_params,
                    array(
                        'type'              => $setting->type,
                        'user_id'           => $args['user_id'],
                        'date_modified_gmt' => current_time( 'mysql', true ),
                    )
                );

                // Clear starter_content flag in data if changeset is not explicitly being updated for starter content.                 if ( empty( $args['starter_content'] ) ) {
                    unset( $data[ $changeset_setting_id ]['starter_content'] );
                }
            }
        }

        $filter_context = array(
            
if ( false === $dt ) {
                    return gmdate( 'Y-m-d H:i:s', false );
                }

                return $dt->setTimezone( $wp_timezone )->format( 'Y-m-d H:i:s' );
            }
        }

        $datetime = array_map( 'absint', $datetime );

        if ( ! isset( $datetime['year'] ) ) {
            $datetime['year'] = current_time( 'Y' );
        }

        if ( ! isset( $datetime['month'] ) ) {
            $datetime['month'] = ( $default_to_max ) ? 12 : 1;
        }

        if ( ! isset( $datetime['day'] ) ) {
            $datetime['day'] = ( $default_to_max ) ? (int) gmdate( 't', mktime( 0, 0, 0, $datetime['month'], 1, $datetime['year'] ) ) : 1;
        }

        if ( ! isset( $datetime['hour'] ) ) {
            
if ( empty( $postarr['post_date_gmt'] ) || '0000-00-00 00:00:00' === $postarr['post_date_gmt'] ) {
        if ( ! in_array( $post_statusget_post_stati( array( 'date_floating' => true ) ), true ) ) {
            $post_date_gmt = get_gmt_from_date( $post_date );
        } else {
            $post_date_gmt = '0000-00-00 00:00:00';
        }
    } else {
        $post_date_gmt = $postarr['post_date_gmt'];
    }

    if ( $update || '0000-00-00 00:00:00' === $post_date ) {
        $post_modified     = current_time( 'mysql' );
        $post_modified_gmt = current_time( 'mysql', 1 );
    } else {
        $post_modified     = $post_date;
        $post_modified_gmt = $post_date_gmt;
    }

    if ( 'attachment' !== $post_type ) {
        $now = gmdate( 'Y-m-d H:i:s' );

        if ( 'publish' === $post_status ) {
            if ( strtotime( $post_date_gmt ) - strtotime( $now ) >= MINUTE_IN_SECONDS ) {
                
// It seems MySQL's weeks disagree with PHP's.         $d         = ( ( $w - 1 ) * 7 ) + 6;
        $thismonth = $wpdb->get_var( "SELECT DATE_FORMAT((DATE_ADD('{$thisyear}0101', INTERVAL $d DAY) ), '%m')" );
    } elseif ( ! empty( $m ) ) {
        $thisyear = (int) substr( $m, 0, 4 );
        if ( strlen( $m ) < 6 ) {
            $thismonth = '01';
        } else {
            $thismonth = zeroise( (int) substr( $m, 4, 2 ), 2 );
        }
    } else {
        $thisyear  = current_time( 'Y' );
        $thismonth = current_time( 'm' );
    }

    $unixmonth = mktime( 0, 0, 0, $thismonth, 1, $thisyear );
    $last_day  = gmdate( 't', $unixmonth );

    // Get the next and previous month and year with at least one post.     $previous = $wpdb->get_row(
        "SELECT MONTH(post_date) AS month, YEAR(post_date) AS year FROM $wpdb->posts WHERE post_date < '$thisyear-$thismonth-01' AND post_type = 'post' AND post_status = 'publish' ORDER BY post_date DESC LIMIT 1"

function wp_insert_site( array $data ) {
    global $wpdb;

    $now = current_time( 'mysql', true );

    $defaults = array(
        'domain'       => '',
        'path'         => '/',
        'network_id'   => get_current_network_id(),
        'registered'   => $now,
        'last_updated' => $now,
        'public'       => 1,
        'archived'     => 0,
        'mature'       => 0,
        'spam'         => 0,
        

function get_year_link( $year ) {
    global $wp_rewrite;
    if ( ! $year ) {
        $year = current_time( 'Y' );
    }
    $yearlink = $wp_rewrite->get_year_permastruct();
    if ( ! empty( $yearlink ) ) {
        $yearlink = str_replace( '%year%', $year$yearlink );
        $yearlink = home_url( user_trailingslashit( $yearlink, 'year' ) );
    } else {
        $yearlink = home_url( '?m=' . $year );
    }

    /** * Filters the year archive permalink. * * @since 1.5.0 * * @param string $yearlink Permalink for the year archive. * @param int $year Year for the archive. */
Home | Imprint | This part of the site doesn't use cookies.