When was the ban on gay people serving in the US military lifted?

LGBT people have been able to serve openly in the US Military as of 2011. However, as of 2017 (the date of this answer), the issue of transgender people being suddenly banned by Donald Trump has come up, and is not fully resolved yet.