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

Popular posts from this blog

formatting - SAS SQL Datepart function returning odd values -

c++ - Apple Mach-O Linker Error(Duplicate Symbols For Architecture armv7) -

php - Yii 2: Unable to find a class into the extension 'yii2-admin' -