How can I get the ID for an archive page? [closed]

If this is a true page, then you can get the ID of that specific page with get_queried_object_id(). This works and will return the ID on the specific pages, single, category, taxonomy, tag and author pages where it is used. True date and time archives and the homepage will not have ID’s

You can do the following

$page_id = get_queried_object_id();
echo $page_id;

Just one very important note, query_posts breaks the main query which breaks the functionality above. This will lead to incorrect data. So make sure that you never ever use query_posts