Cannabis has been known to ancient Chinese and other inhabitants of Central Asia centuries before it came to the attention of other civilisations.
According to some sources cannabis was used for medical purposes for the first time during the legendary emperor Shen Nung during the 3rd millennium BC. [1,3] Emperor Shen Nung is famous with his contribution to the development of agriculture and medicine in Ancient China, although some authors question his existence .
Unfortunately the original manuscripts were lost but their copies reveal that cannabis was used for rheumatism, gynecological diseases, absentmindedness and malaria. It was documented that excessive use could cause intoxication described as “appearance of spirits”.
The famous surgeon, Hua Tu (115-205 AD), who is known for using anaesthesia for the first time, has used cannabis. [1,3]
However, cannabis was not only used for its medicinal properties. The oldest preserved specimens of hemp were parts of cloth dated back around 1200 BC. Hemp was used in Chinese society for producing cloths until 10-11th century when cotton was introduced. Hemp was also used to make paper. During the period 33-7 BC was written a manual with farming techniques for growing cannabis. During the emperor Wang Mang (9-23 AD) cannabis was even used as currency due to decline in trust in coins. 
Interestingly, there were very detailed records from Han dynasty (206 BC – 220 AD) on selection of the best season to sow hemp, principles of field controls and how to select higher quality fibers from the male plants to spin textile yarn. The cultivation in Ancient China was different from cultivation today. They used to sow cannabis early (in January) in order plants to reach a large size before they were pollinated. This method could increase seed yield significantly. Also there were records of simple methods used to distinguish different sexes, which was described 1,800 years ago: “Generally, male hemp seeds* are white. There are two ways to examine the quality of the white seeds. The first is to bite a seed with the teeth, and if the inside of the seed is very dry, it should not be sown. Otherwise the seeds can be sown. The second method is to put the white seed in the mouth for some time. The seeds that do not turn black are good.” The accuracy of these methods was not certain. 
*By “male hemp seeds” the authors mean seeds, which will grow into male plants.
Read more at Cannabis Chronicles