A function is used to represent a method that is used by the user to perform a task. In a function having a task of getting the total amount of text sent in a month, the user must consider the restriction of the date sent by the user if the day is less than 30 or 31 of the month. If the restriction is valid, the function will count and if not it will skip the text and proceed to another data.