Is there a template tag I can use to link to the archive page corresponding to the month that a post was published on?

This is straight from the WordPress codex

<?php $arc_year = get_the_time('Y'); ?>
<?php $arc_month = get_the_time('m'); ?>

<a href="https://wordpress.stackexchange.com/questions/18602/<?php echo get_month_link($arc_year, $arc_month); ?>">archive for <?php the_time('F Y'); ?></a>

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