Forum Moderators: coopster

Message Too Old, No Replies

Finding weekday in the past

invalid format

         

WhosAWhata

10:13 pm on Nov 8, 2004 (gmt 0)

10+ Year Member



i know you can find dates using date(D,date(U)-seconds)

i have a date in the format YYYYMMDD how do i find the day?

coopster

10:32 pm on Nov 8, 2004 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



day as in Monday, Tuesday...? Where is the date coming from? Database or form?

jatar_k

11:15 pm on Nov 8, 2004 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



I am sure coop can give you a fancy mysql answer ;) but this works

$initdate = "20020709";
$year = substr ($initdate,0,4);
$month = substr ($initdate,4,2);
$day = substr ($initdate,6,2);
echo date("l", mktime(0,0,0,$month,$day,$year));

WhosAWhata

12:02 am on Nov 9, 2004 (gmt 0)

10+ Year Member



perfect

coopster

12:06 am on Nov 9, 2004 (gmt 0)

WebmasterWorld Administrator 10+ Year Member




I am sure coop can give you a fancy mysql answer ;) but this works

Actually, I was just too lazy to key in the PHP solution, thought I'd hold out for a "yes, I'm getting it from a database" response -- hehe ;)

WhosAWhata

12:30 am on Nov 9, 2004 (gmt 0)

10+ Year Member



its actually not coming from a mySQL database. my client is afraid to have mySQL because they don't know it and they want to be able to change the code on their own if they have to. So I guess you could call it a flat-file database. the date is the filename