The Korean calendar is derived from the Chinese calendar. The traditional calendar designated its years via Korean era names from 270 to 963, then Chinese era names with Korean era names were used a few times until 1894. In 1894 and 1895, the lunar calendar was used with years numbered from the foundation of the Joseon Dynasty in 1392.
The Gregorian calendar was adopted on 1 January 1896, with Korean era name "Geonyang (건양 / 建陽, "adopting solar calendar")."
From 1945 until 1961 in South Korea, Gregorian calendar years were counted from the foundation of Gojoseon in 2333 BC (regarded as year one), the date of the legendary founding of Korea by Dangun, hence these Dangi (단기 / 檀紀) years were 4278 to 4294. This numbering was informally used with the Korean lunar calendar before 1945 but has only been occasionally used since 1961, and mostly in North Korea prior to 1997.
Although not being an official calender, in South Korea, the traditional Korean calendar is still maintained by the government. The current version is based on China's Shixian calendar ("siheonnyeok 시헌력(時憲暦)" in Korean), which was in turn developed by Jesuit scholars. However, because the Korean calendar is now based on the moon's shape seen from Korea, occasionally the calendar diverges from the traditional Chinese calendar by one day, even though the underlying rule is the same. As a result, sometime the New Year's Day differ by one between the two countries, which last happened in 1997.
In North Korea, the Juche calendar has been used since 1997 to number its years, based on the birth of the state's founder Kim Il-sung.