The need for electrical energy is peaking. As the resources are limited the effective utilization of the energy is essential. Demand side management plays a vital role in this context. It is the modification of energy demand by the consumer either by financial incentives or by education. Many of the countries successfully tried time of the day pricing method for implementing demand side management. This paper mainly focusing on the development of an algorithm which will help to optimize the cost where the time of the day based demand side managemt is used.