I was wondering if there is a way to use the locale in strftime to echo all days of the week, regardless of date. To use as sort of headings or titles and rather than using constants and loading the correct one.
i.e.
setlocale(LC_TIME, "de_DE");
echo strftime("%A", 1); //echos Monday
echo strftime("%A", 2); //echos Tuesday
echo strftime("%A", 3); //echos Wednesday
so that all I need to do is change the locale for a different language.
Thanks
setlocale(LC_TIME, "de_DE");
echo strftime("%A", strtotime("next Sunday"));
echo strftime("%A", strtotime("next Monday"));
echo strftime("%A", strtotime("next Tuesday"));
echo strftime("%A", strtotime("next Wednesday"));
echo strftime("%A", strtotime("next Thursday"));
echo strftime("%A", strtotime("next Friday"));
echo strftime("%A", strtotime("next Saturday"));
You could alternatively create a simple for loop:
for ($i=0;$i<7;$i++) {
$weekday[] = strftime('%a ', mktime(0, 0, 0, 6, $i+2, 2013));
}
print_r($weekday);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With