Will this work properly in future?
#1

Hey, will this code work properly tommorow, after-tommorow and in the future? (If it will update the correct data)

For today, it outputs: Saturday, October, 2011.

pawn Код:
stock GetDate()
{
    new year,month,day, str[128], dtext[50], mtext[50];
    getdate(year, month, day);
    new j, e;
    if (month <= 2)
    {
        month += 12;
        --year;
    }
    j = year % 100;
    e = year / 100;
    switch(day)
    {
        case 0: dtext = "Friday";
        case 1: dtext = "Saturday";
        case 2: dtext = "Sunday";
        case 3: dtext = "Monday";
        case 4: dtext = "Tuesday";
        case 5: dtext = "Wednesday";
        case 6: dtext = "Thursday";
    }
    switch(month)
    {
        case 1: mtext = "January";
        case 2: mtext = "February";
        case 3: mtext = "March";
        case 4: mtext = "April";
        case 5: mtext = "May";
        case 6: mtext = "June";
        case 7: mtext = "July";
        case 8: mtext = "August";
        case 9: mtext = "September";
        case 10: mtext = "October";
        case 11: mtext = "November";
        case 12: mtext = "December";
    }
    format(str,sizeof(str),"%s, %s, %d", dtext, mtext, year);
    return ((day + (month+1)*26/10 + j + j/4 + e/4 - 2*e) % 7), str;
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)