Schengen Visa Validity
Schengen visas act as both entry and stay permits (I.e. there is no distinction between the two as is the case for USA. for example.). Hence your visa is valid until the 24th April, and you must leave the country no later than at 23:59 of that day. I understand how it might be confusing since you are told two metrics: validity dates and validity duration. However you can think of it this way: the validity dates have priority over the duration. If you enter the country after the validity period begins, you still must leave before that same period ends, regardless of the effective number of days you stayed.
Renewing Type D Visa
I'm not sure about type D visa extensions, and this seems to be highly country-dependent. I found this web page of the Universitat Àutonoma de Barcelona stating that you can't extend the type D visa while in Spain:
You should check how much time you will spend in Spain, since there is a Type D visa limited to only 180 days (Visado D Estudios hasta 180 días), and under no circumstances may you renew this visa once you are in Spain or apply for a Student Residence Card with a limited type visa. If you are planning to stay more than six months, you will need to obtain a Type D student visa (“open”) before leaving your country.
Important: A visa can never be changed in Spain. The only visa valid is the one obtained from the Spanish Embassy or Consulate before coming to Spain. Only those with a Type D student visa (“open”) will be allowed to obtain a Student Residence Card once they arrive to Spain.
This other website seems to agree:
Please Note: once a student has arrived in Spain, it is not possible for them neither to change a 180-day study visa for a multiple entry visa or a visa permitting a longer stay in Spain nor apply for a NIE. You cannot request for a visa extension.That is, in the case that you hold a 180-day D type visa, after finishing the course you would like to stay for a longer time in Spain or enroll in another course, you must return to your home country before the visa expires and apply for a new visa from Spanish consulate.
Hence contact your local Spanish embassy/consulate or your international students advisor and ask for more information.