Advertisement
DraKiNs

[COD] GetWeekName

Jun 26th, 2011
369
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 0.58 KB | None | 0 0
  1. GetWeekName(day=0, month=0, year=0)
  2. {
  3.     new
  4.         sStr[24] = "Inválido",
  5.         iBissext = (year % 100),
  6.         iWeekDay = (year / 100);
  7.  
  8.     if(month < 3) month += 12,year--;
  9.     new iWeek = ((day + (month+1)*26/10 + iBissext + iBissext/4 + iWeekDay/4 - 2*iWeekDay) % 7);
  10.  
  11.     sStr =
  12.     (
  13.         (iWeek == 0x0) ? ("Sábado") :
  14.         (iWeek == 0x1) ? ("Domingo")    :
  15.         (iWeek == 0x2) ? ("Segunda")    :
  16.         (iWeek == 0x3) ? ("Terça")  :
  17.         (iWeek == 0x4) ? ("Quarta") :
  18.         (iWeek == 0x5) ? ("Quinta") :
  19.         (iWeek == 0x6) ? ("Sexta")  :  ("Inválido")
  20.     );
  21.     return sStr;
  22. }
  23.  
  24. // DraKiNs
  25. // www.ips-team.blogspot.com
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement