How to get yesterday’s date in Linux

One of these methods:

date -d "yesterday" '+%Y-%m-%d'
date -d "1 day ago" '+%Y-%m-%d'