OK GOT IT!! $utine = strtotime("26-Nov-2001"); $bday=(int)$utine;
$utoday = strtotime(""); $btoday = (int)$utoday; if((($bday-$btoday) <= 1209600 && ($bday-$btoday)>0)){ print "you have " . round(($bday-$btoday)/86400)." Days till 'blanks' bday<br>"; print "you are within the two week range."; }else{ print "you are NOT within the date range."; } It's messy but it works, thanks everybody that helped me out on this. (C: [EMAIL PROTECTED] wrote: >date("z"); // the today's ordinal number > >z - day of the year; i.e. "0" to "365" > >if you want the ordinal number of other days different than the current one >you can play with mktime or strftime or strtotime to make an appropiate >timestamp as you did in your earlier codes. > > >----- Original Message ----- >From: "Martin Towell" <[EMAIL PROTECTED]> >To: "GENERAL PHP LIST" <[EMAIL PROTECTED]> >Sent: Wednesday, November 14, 2001 3:19 AM >Subject: RE: [PHP] take date and convert to day of year > > >>I'm running on WinNT4 w/ PHP 4.0.6 and the code I supplied came back with >>333 >>and for today I get 317 >>dunno why you're getting 364 >>anyone, any eye-dears ?? >> >>-----Original Message----- >>From: sundogcurt [mailto:[EMAIL PROTECTED]] >>Sent: Wednesday, November 14, 2001 12:14 PM >>To: GENERAL PHP LIST >>Subject: Re: [PHP] take date and convert to day of year >> >> >>I have tried to implement your code Martin, and I do thank you VERY MUCH >>for the help, but your code seems to have the same trouble as mine, it >>doesn't matter what date I start with, I end up with 364 as the day of >>the year, I am on win32 though I don't know if that matters. >> >>Here is what I tried: >> >> >>//FORMAT HAS TO BE date("d-M-Y"); >>//GET DAY OF YEAR FOR DOB utime = UNIX time >>$utine = strtotime("30-Nov-1971"); >>$dob = getdate($utime); >>$dobnum = $dob['yday']; >>print "dob is " . $dobnum . "<br>"; >> >>//GET DAY OF YEAR FOR TODAY >>//$today = date("d-M-Y"); >>$utoday = strtotime(date("d-M-Y")); >>$today = getdate($utoday); >>$todaynum = $today['yday']; >>print "today is " . $todaynum . "<br>"; >> >>There should be a different of about 17 days here right? Not if this is >>returning 364 for $dobnum, then it's 48! >> >> >>[EMAIL PROTECTED] wrote: >> >>>looking at the manual, getdate() is meant to be passed a unix time stamp, >>>so, you'll need to use strtotime() first thus: >>> >>>$utime = strtotime("30-Nov-1971"); >>>$dob = getdate($utime); >>>$dobnum = $dob['yday']; >>>print $dobnum; >>> >>>Notice I changed the format of the date, when I tried using the original >>>format, strtotime() complained, saying it couldn't convert it. >>> >>>Martin T >>> >>>-----Original Message----- >>>From: sundogcurt [mailto:[EMAIL PROTECTED]] >>>Sent: Wednesday, November 14, 2001 7:57 AM >>>To: GENERAL PHP LIST >>>Subject: [PHP] take date and convert to day of year >>> >>> >>>Hi guys, I know that you can take todays date and display it as the >>>numeric day of the year, 1 - 365 / 0 - 364 etc. >>>But can you take a date such as (November-30-1971) and convert that to >>>the numeric day of the year? >>> >>>I have been trying to do this but have had no joy, I don't think my code >>>is even close. >>> >>>$dob = getdate("Nov-30-1971"); >>>$dobnum = $dob['yday']; >>>print $dobnum; >>> >>>$dob 'should' be an array and 'yday' should be the numeric value for the >>>day of the year, right?!? >>> >>>This is what I am trying, and how I understand it, using 'yday' should >>>give you basically the same output as date ("z"); >>> >>>What I would like is the ability to convert any date to the days numeric >>>value. Any help would be GREATLY appreciated. >>> >>>(C: >>> >>> >> >> >>-- >>PHP General Mailing List (http://www.php.net/) >>To unsubscribe, e-mail: [EMAIL PROTECTED] >>For additional commands, e-mail: [EMAIL PROTECTED] >>To contact the list administrators, e-mail: [EMAIL PROTECTED] >> >