Legal drinking age is 20 in Thailand. However, ID checks are not done very strictly in the country; many bars will sell you alcohol without checking ID
When you are allowed to buy:
Legally alcohol can be sold only between 11am-2pm, 5pm-midnight
Additionally, alcohol cannot be sold on these Buddhist holidays (the specific date varies by year):