Get all the machine names of the date formats
Date formats are entities so you can use the Entity Type Manager service:

$formats = \Drupal::entityTypeManager()
  -&gt;getStorage('date_format')
  -&gt;loadMultiple();

$ids = array_keys($formats);