how soon can ultrasound tell sex of baby

I heard that boys are easier to tell early as 12 weeks. but girls are hard to confirm until 18-20 weeks.

With my son we knew he was going to be a boy at my 12 week ultrasound.