i am making an application in which after few using the application 20 times user will stop at splash screen and show text "Demo version is over" after that a button pop up "Purchase app". After clicking on that button a new page will appear saying monthly or yearly.   

Example:  
 if user wants one month subscription then after paying(using any payment gateway) The App will run from current date to next 30 days(One Month). after that same procedure.  

what i need is maintaining this 30 days by code from current date in my application. after that 30 days validity is over showing same text message "Purchase your subscription".

Thanks you.