Factorize some functions

Invoke twice the format method instead of get month and year is probably slower. I think performances of this method should be tested before merged.