A teaspoon is a standard/imperial measure for volume. A teaspoon of sand and a teaspoon of oil will have the same volume, but the the sand and oil will have differing weights. Milligrams are a metric measure of weight. In order to accurately convert from a volume of a specific material to the weight of that material all you need to do is use a scale.
Carefully measure the desired material into the teaspoon. Do not over fill the spoon. Level the material with a flat-edged tool like a knife.
Place the measured amount onto the scale.
Note or record the weight of the material in milligrams. This is what a teaspoon of a given substance will weigh in milligrams.
Use the milligram weight of one teaspoon of the substance to convert other teaspoon-measured amounts into milligrams.
Some common conversions :
1 teaspoon (tsp) of salt = 6 grams (g) or 6000 milligrams (mg)
1 tsp sugar = 4.2g or 4200mg
1 tsp flour = 2.5g or 2500mg