Need a function that returns day.
#1

As mention in title. Yes, i know i can use 'getdate' but this one is different.
I need a function that returns day as string. Ex: Monday, Tuesday, etc..
Reply
#2

PHP код:
GetWeekDay(day=0month=0year=0)
{
  if (!
day)
    
getdate(yearmonthday);
  new
    
weekday_str[10],
    
j,
    
e
  
;
  if (
month <= 2)
  {
    
month += 12;
    --
year;
  }
  
year 100;
  
year 100;
  switch ((
day + (month+1)*26/10 j/e/2*e) % 7)
  {
    case 
0weekday_str "Saturday";
    case 
1weekday_str "Sunday";
    case 
2weekday_str "Monday";
    case 
3weekday_str "Tuesday";
    case 
4weekday_str "Wednesday";
    case 
5weekday_str "Thursday";
    case 
6weekday_str "Friday";
  }
  return 
weekday_str;

I literally just did 1 ****** search and found it. Please use the search feature, it's really not that difficult.

EDIT: It might give the 1st and second day of the week as saturday and sunday, change it to this if it does and you don't want it:
PHP код:
    case 0weekday_str "Monday";
    case 
1weekday_str "Tuesday";
    case 
2weekday_str "Wednesday";
    case 
3weekday_str "Thursday";
    case 
4weekday_str "Friday";
    case 
5weekday_str "Saturday";
    case 
6weekday_str "Sunday"
Reply
#3

Just use this and edit it.

http://forum.sa-mp.com/showpost.php?...07&postcount=5

Credits to yom for making it


Edit: Look's like someone beat me to it.
Reply
#4

Thanks, guys.
+Rep
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)