You could use mktime() with date, too... $first_day = date("w",mktime(0,0,1,$month,1,$year));
Set your $month and $year accordingly. ---John Holmes... > -----Original Message----- > From: Attila [mailto:[EMAIL PROTECTED]] > Sent: Monday, July 15, 2002 8:07 PM > To: [EMAIL PROTECTED] > Subject: Re: [PHP] Date () Help please > > OK thought I should share in case any needs it but got it to work. Here > is > what it looks like and thanks to Richard Baskett for the help. > > $yr= date (Y); > $mnth = date (F); > $dy= 1; > $string = "$dy $mnth $yr"; > $today = date("w",strtotime($string)); > > Thanks for the help > Attila > http://www.glorynaspiration.com > > > "Attila" <[EMAIL PROTECTED]> wrote in message > [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > > Ok your way works and thanks for the help but still struggling a little > bit > > here is what I have. > > > > $year = date (Y); //This gets me the current year 2002 > > $month = date (m); //This gets me the current month 07 > > $day= 1; //always looking for the 1st day of the > month > > $string = "$year $month $day"; > > $today = date("w",strtotime($string)); > > echo $today; > > > > My result is: 3 > > > > What am I doing wrong should this work???? > > > > Thanks for the help > > attila > > http://www.glorynaspiration.com > > > > > > > > > > "Richard Baskett" <[EMAIL PROTECTED]> wrote in message > > [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > > > $today = date("w"); // $today will result in '1' > > > $today = date("D"); // $today will result in 'Mon' > > > $today = date("l"); // $today will result in 'Monday' > > > > > > Now if you wanted to feed the script something like this: > > > > > > $string = "01 Jul 2002"; > > > $today = date("l",strtotime($string)); > > > > > > This will result in the long textual day of '01 Jul 2002', so 'Monday' > or > > if > > > you interchange the "l" in the first part of the date function with > "w" > > you > > > will get the the day of the week, numeric, i.e. "0" (Sunday) to "6" > > > (Saturday) or if you use "D" you will get the short textual day so > 'Mon' > > > > > > I hope all of that makes sense to you. Check out the php manual for > the > > > function date and strtotime. > > > > > > http://www.php.net/date > > > http://www.php.net/strtotime > > > > > > Rick > > > > > > "Trust in the Lord with all your heart, And lean not on your own > > > understanding; In all your ways acknowledge Him, And he shall direct > your > > > paths." - Proverbs 3:5-6 > > > > > > > > > > From: "Attila" <[EMAIL PROTECTED]> > > > > Date: Mon, 15 Jul 2002 16:44:39 -0600 > > > > To: [EMAIL PROTECTED] > > > > Subject: [PHP] Date () Help please > > > > > > > > Hello all, > > > > I am very new to PHP and I have added some minor PHP to my > website. > I > > > > would like to make a PHP calander to keep track of things going on. > > Could > > > > someone tell me how I can get the first day of every month. > > > > > > > > For Example: > > > > 01 Jul 2002 was a Monday. > > > > 01 Mar 2002 will be a Thursday > > > > > > > > I need the dates to start my tables so they insert the numbers in > the > > right > > > > day. > > > > > > > > Thanks, > > > > Attila > > > > > > > > > > > > > > > > -- > > > > PHP General Mailing List (http://www.php.net/) > > > > To unsubscribe, visit: http://www.php.net/unsub.php > > > > > > > > > > > > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php