### Theory:

Step 1: If the given time is $$12\!:\!00$$ a.m. (midnight), change $$12\!:\!00$$ a.m. as $$00\!:\!00$$ hours and proceed further. There is no change up to $$12\!:\!59$$ p.m.

Step 2: If the given time is $$1\!:\!00$$ a. m. to $$12\!:\!59$$ p.m., then no time change in $$24$$-hour format. Just write the time as it is in $$4$$ digits.

Step 3: If the given time is $$1\!:\!00$$ p.m. to $$11\!:\!59$$ p.m., add $$12\!:\!00$$ hours to the given time and write it in $$4$$ digits.
Example:
1. Convert $$12\!:\!15$$ a.m. to $$24$$-hour format.

Solution:

By using the above procedure, change $$12\!:\!00$$ a.m. as $$00\!:\!00$$ hours.

Therefore, $$12\!:\!15$$ a.m. $$=$$ $$00\!:\!15$$ hours

2. Write $$8\!:\!45$$ a.m. in $$24$$-hour format.

Solution:

$$8\!:\!45$$ a.m. lies between $$1\!:\!00$$ a.m. to $$12\!:\!59$$ p.m.

By the above procedure, no time change between $$1\!:\!00$$ a.m. to $$12\!:\!59$$ p.m.

Write the time as it is in $$4$$ digits.

Therefore, $$8\!:\!45$$ a.m. $$=$$ $$08\!:\!45$$ hours.

3. Convert $$8:45$$ p.m. in railway format.

Solution:

$$8:45$$ p.m. lies between $$1:00$$ p.m. to $$11:59$$ p.m.

Add $$12:00$$ hours to the given time by the above procedure.

$\begin{array}{l}\phantom{\rule{0.882em}{0ex}}8:45\\ \underset{¯}{+12:00}\\ \underset{¯}{\phantom{\rule{0.588em}{0ex}}20:45}\end{array}$

Therefore, $$8:45$$ p.m. $$=$$ $$20:45$$ hours.
Important!
1. Write hours at the end of the $$24$$-hour time format. Don't write a.m. or p.m. at the end of $$24$$-hour format.

2. Minutes will not change in both $$12$$-hour and $$24$$-hour formats.