Reset Arduino. software-hardware

In some of my projects, I want to reset the arduino ever day, or ever month. Is there any problem in using this function?

void resetArduinoPin2() { // reset pin connected to D2 pin
    pinMode(2, OUTPUT);

I have been testing it for a couple days, and it seems to have no problems. What do you think?

Is there a better way?

No problem if it works but you waste one I/O pin. You could use also SW reset to do same job. Look:

Use the watchdog - no pins required.

Thanks for the advice guys !