Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*----------------------------------------
- *
- * Give Days (Adicionar Dias)
- * Criado por DraKiNs (thanks Miki)
- * (c) Copyright 2011, [iPs]TeaM
- *
- /*-------------------------------------- */
- giveDays(iDia,iMes,iAno,iDias)
- {
- new
- iMeses[12] = {1,0,2,0,4,0,6,0,8,9,0,11},
- sString[32];
- iDia += iDias,iDia -= 1,iMes -= 1, iAno -= 1;
- while(iDia > 30 || iMes > 12) {
- iDia = ((!(iAno%400)||!(iAno%4)&&(iAno%100)) && iMes == 2 && iDia > 29) ? (iMes++,iDia - 31) : iDia; iMes = (iMes > 11) ? (iAno++, iMes - 11) : iMes;
- iDia = (iMeses[iMes] && iDia > 31) ? (iMes++,iDia - 31) : iDia; iMes = (iMes > 11) ? (iAno++, iMes - 11) : iMes;
- iDia = (!iMeses[iMes] && iDia > 30) ? (iMes++,iDia - 30) : iDia; iMes = (iMes > 11) ? (iAno++, iMes - 11) : iMes;
- }
- iDia += 1, iMes += 1, iAno += 1;
- return format(sString, 32, "%02d/%02d/%02d", iDia , iMes, iAno), sString;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement