how to use date.getmonth to return appending 0 for single digit code example Example: get month in two digit in javascript date ("0" + (this.getMonth() + 1)).slice(-2)