I understand that they both mean "husband" in some capacity; are there any differences in formality or connotation between the two? Thanks!
What is the difference between 老公 (lǎo gōng) and 丈夫 (zhàng fu)?
老公 is a 昵稱 (pet name/ nickname) for husband; 丈夫 is the formal term of husband.
In any official document, you will only see 丈夫 and never 老公 as the term of 'husband'
It is similar to "dad vs. father" ; "mom vs. mother" in English
Since 老公 is a pet name, it is often used to address to the male half of a couple, doesn't matter if they are actually married or not