php - Getting Day name from day of week -
php - Getting Day name from day of week -
i have 7 records in mysql database each corresponsing day of week 0-6
now php script want display instead of 0, 'sunday' or instead of 1 show 'monday'.
is there function available takes numeric days of week , returns name of week day?
you utilize date function, format l
:
l (lowercase 'l')
a total textual representation of day of week
http://php.net/manual/en/function.date.php
and utilize fact sunday 0:
echo date('l', strtotime("sunday +{$day_number} days"));
or function:
function getdaynamefromdaynumber($day_number) { homecoming date('l', strtotime("sunday +{$day_number} days")); }
php cakephp
Comments
Post a Comment