Replicate the_date function when using a custom field

You can use date_query with is very usefull. In this snipet we get a week most viewed posts.

<?php 
                                        $args = array(
                                            'date_query' => array(
                                                array(
                                                    'year' => date('Y'),
                                                    'week' => date('W'),
                                                ),
                                            ),
                                           'post_type'    => 'post',
                                           'post_status'  => 'publish',
                                           'meta_key' => 'post_views_count',
                                           'orderby' => 'meta_value',
                                           'order' => 'DESC',
                                           'showposts' => '5'
                                        );
                                        $my_query = new WP_Query( $args );
                                        ?>

Here is more examples for use a date_query argument. http://www.hongkiat.com/blog/wordpress-date-query/

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