Since the days of flip clocks, alarms have always had one function—make a bunch of annoying racket early in the morning to ensure that you wake up in time. And this simple MO has stayed in place while technology advances at a breakneck pace, almost in spite of the fact that today's devices are capable of doing far more than beeping at 7 in the morning.
Apple finally brought alarm clocks into this century starting in iOS 10, and the Clock app's new features work similarly in iOS 11 and iOS 12 on newer devices. Aside from the old-style alarms you're accustomed to, there's a feature called "Bedtime" (previously called "Wake Alarm") that's definitely worth setting up. It tells you when it's time to go to bed, tracks your sleep habits, and even lets you set a separate alarm volume. Plus, you can export some of the data to Apple Health.
To try out the Bedtime feature, start by heading to the "Bedtime" tab in the Clock app. From here, tap "Get Started," then tell the app what time you'd like to wake up in the morning. Next, you'll be asked to select which days the alarm will go off, so take care of that, then tap "Next."
At this point, the app will ask you how many hours you'd like to sleep each night. This is a pretty important aspect of Bedtime, so give it some thought, then pick a number. Next, you'll be asked when you'd like to be reminded that it's time to go to bed, and when you're done there, you can pick an alarm sound.
Near the end of setup, you'll get a glimpse of the sleep-tracking feature, which uses the bedtime reminder and the next morning's alarm to measure how long you've slept. This will be visible by scrolling down on the Bedtime tab in the future, so go ahead and tap "Save" to finalize your work.
In general, the Bedtime functions about how you would expect, with one notable exception: When bedtime comes around, you'll get a silent notification on your lock screen reminding you that it's almost time to hit the hay. Options on this notification will allow you to confirm that you're going to sleep or have it remind you again after a certain number of minutes.
In the future, if you decide that you'd like to adjust your Bedtime, start by heading to the Bedtime tab. From here, you can drag the moon icon around the circle to adjust the target sleep time, and you can do the same with the bell icon for your target wake time. But if you'd like to keep the same sleep interval and simply adjust the wake and sleep time instead, you can drag from any portion of the semi-circle to move the sleep and wake times simultaneously.
Another awesome aspect to Bedtime is that you can finally set an alarm volume that is independent of any other system volume levels. To try this out, head to the Bedtime tab again, then tap the "Options" button at the top of the screen. From here, you'll see the alarm-specific volume slider at the bottom of the screen, which should be straightforward, but make sure to tap "Done" after making any changes.
As you can probably tell from some of the screenshots above, you can see "Sleep Analysis" data in the "Bedtime" tab in the Clock app. The data here shows you how long you slept, based on your bedtime and wake times set, but it knows when you're using your iPhone. So if you're using your iPhone after your bedtime, it won't count that as sleep time. If you snooze the alarm in the morning, it will count that as more bedtime in the details.
By default, this sleep data is automatically synced with your Apple Health app. However, if for some reason it's not or you turned it off, you can enable it via the "Health" option in your device's "Privacy" settings.