Get the day of the week
#1

How do you make a function to return the week DAY? By this I mean Monday, Tuesday, Wednesday etc.
Reply
#2

******.com

Edit: i know this link is in LUA but im trying to translate it best i can at the moment,
http://lua-users.org/wiki/DayOfWeekA...InMonthExample
Reply
#3

pawn Code:
stock GetWeek(d,m,y) //by drakins,thanks vine
{
    m=(m-=2);
    if(m<=0) --y,m+=12;
    return ( ((
        (d+((13*m-1)/5)+(y%100)+((y%100)/4)+(((y%100)%100)/4)-2*(y%100))%7) == 0)?
        (((d+((13*m-1)/5)+(y%100)+((y%100)/4)+(((y%100)%100)/4
        )-2*(y%100))%7) + 1) : (((d+((13*m-1)/5)+(y%100)+((y%100)/4)+
        (((y%100)%100)/4)-2*(y%100))%7)
    ) );
}
Quote:

#define GetWeek() ((getdate() % 0x7) + 0x6)

Reply
#4

Edited. Misunderstood the post. D;
Reply
#5

Quote:
Originally Posted by Emmet_
View Post
This should do the trick.

pawn Code:
stock ReturnWeekDay()
{
    new
        weekday[16];
        year,
        month,
        day;
    getdate(year, month, day);
    switch(month)
    {
        case 1: weekday = "January";
        case 2: weekday = "February";
        case 3: weekday = "March";
        case 4: weekday = "April";
        case 5: weekday = "May";
        case 6: weekday = "June";
        case 7: weekday = "July";
        case 8: weekday = "August";
        case 9: weekday = "September";
        case 10: weekday = "October";
        case 11: weekday = "November";
        case 12: weekday = "December";
        default: weekday = "Unknown";
    }
    return weekday;
}



He meant to return the weekday such as Monday, Tuesday, Wednesday.
uR Code gives month not the day
Reply
#6

Quote:
Originally Posted by SourceCode
View Post
uR Code gives month not the day
FAIL! Thanks for mentioning that!
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)