Last active
January 27, 2016 07:36
-
-
Save ziggi/30bb6cae816687db36b3 to your computer and use it in GitHub Desktop.
return week name by date
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
enum WeekLang { | |
WEEK_LANG_ENGLISH, | |
WEEK_LANG_RUSSIAN, | |
} | |
static const | |
gDaysOfWeek[WeekLang][][] = { | |
{ | |
!"Thursday", | |
!"Friday", | |
!"Saturday", | |
!"Sunday", | |
!"Monday", | |
!"Tuesday", | |
!"Wednesday" | |
}, | |
{ | |
!"Четверг", | |
!"Пятница", | |
!"Суббота", | |
!"Воскресенье", | |
!"Понедельник", | |
!"Вторник", | |
!"Среда" | |
} | |
}; | |
stock GetWeekName(UTC, name[], const size = sizeof(name), const WeekLang:lang = WEEK_LANG_ENGLISH) | |
{ | |
return | |
strunpack(name, gDaysOfWeek[lang][((gettime() + UTC * 3600) / 86400) % 7], size); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment