How can I group posts by months and years?

You can do it like so:

global $post;

$posts = get_posts( array(
    'post_type' => 'press',
    'nopaging'  => true,
    'orderby'   => 'date',
    'order'     => 'DESC', // it's DESC; not DSC
    // There's no use setting posts_per_page when nopaging is enabled.
    // Because posts_per_page will be ignored when nopaging is enabled.
) );

$_year_mon = '';   // previous year-month value
$_has_grp = false; // TRUE if a group was opened
foreach ( $posts as $post ) {
    setup_postdata( $post );

    $time = strtotime( $post->post_date );
    $year = date( 'Y', $time );
    $mon = date( 'F', $time );
    $year_mon = "$year-$mon";

    // Open a new group.
    if ( $year_mon !== $_year_mon ) {
        // Close previous group, if any.
        if ( $_has_grp ) {
            echo '</div><!-- .month -->';
            echo '</div><!-- .year -->';
        }
        $_has_grp = true;

        echo '<div class="year">';
        echo "<span>$year</span>";

        echo '<div class="month">';
        echo "<span>$mon</span>";
    }

    // Display post title.
    if ( $title = get_the_title() ) {
        echo "<div>$title</div>";
    } else {
        echo "<div>#{$post->ID}</div>";
    }

    $_year_mon = $year_mon;
}

// Close the last group, if any.
if ( $_has_grp ) {
    echo '</div><!-- .month -->';
    echo '</div><!-- .year -->';
}

wp_reset_postdata();

tech