How would you write these two sentences:
It's quiet at nighttime.
It was a night-time ritual.
Should I hyphen the second sentence (as I have)?
Looking around the net, there's some indication that this may be something that is different for British vs. American English, but I will speak from the perspective of American English:
Both "nighttime" and "night-time" are grammatically correct in U.S. English, and you can use either one in place of the other. "Nighttime" without a hyphen is generally more common, I think, but using a hyphen would not seem particularly strange either. The use of a hyphen may make it seem a little bit less casual and more formal, depending on the context.
As a side-note, your first sentence is grammatically correct, but I think in general most people would actually leave off the "time" in that case and just say:
It's quiet at night.
This is more a matter of style than grammar. As such, there is no single answer.
However, by conventional wisdom, you should either hyphenate the word or not.
In other words, pick one of the following for consistency:
1. It was a nighttime ritual at nighttime.
2. It was a night-time ritual at night-time.
Choose how you punctuate the noun, and punctuate it the same way when you use it adjectivally (or attributively).
The only instance where you might use hyphenation in one place but not the other is if it's considered to be two actual words or an open compound:
3. It was a night-time ritual at night time.
In the third instance, you normally hyphenate adjectives (or attributive nouns) before a noun, but not after. (Plus it's easily arguable that in this particular sentence what follows at isn't being used adjectivally—or attributively—at all.)