Checking weekdays
#1

So, I found a little code that could show what day of the week it is.

Код:
GetWeekDay(day=0, month=0, year=0)
{
  if (!day)
    getdate(year, month, day);

  new
    weekday_str[10],
    j,
    e
  ;

  if (month <= 2)
  {
    month += 12;
    --year;
  }

  j = year % 100;
  e = year / 100;

  switch ((day + (month+1)*26/10 + j + j/4 + e/4 - 2*e) % 7)
  {
    case 0: weekday_str = "Saturday";
    case 1: weekday_str = "Sunday";
    case 2: weekday_str = "Monday";
    case 3: weekday_str = "Tuesday";
    case 4: weekday_str = "Wednesday";
    case 5: weekday_str = "Thursday";
    case 6: weekday_str = "Friday";
  }

  return weekday_str;
}
The code works nice, but I want to make something that checks for a specific weekday. Anybody have any ideas on how to do this?
Reply


Messages In This Thread
Checking weekdays - by siemka321 - 31.08.2013, 19:31
Re: Checking weekdays - by Rapgangsta - 31.08.2013, 19:55
Re: Checking weekdays - by siemka321 - 31.08.2013, 20:17
Re: Checking weekdays - by Rapgangsta - 31.08.2013, 20:29
Re: Checking weekdays - by siemka321 - 31.08.2013, 21:03
Re: Checking weekdays - by Rapgangsta - 31.08.2013, 21:29
Re: Checking weekdays - by siemka321 - 31.08.2013, 21:49
Re: Checking weekdays - by Rapgangsta - 31.08.2013, 22:41
Re: Checking weekdays - by siemka321 - 01.09.2013, 06:44

Forum Jump:


Users browsing this thread: 2 Guest(s)