Tracking Forums, Newsgroups, Maling Lists
Home Scripts Tutorials Tracker Forums
 
  HOME    TRACKER    PHP




How To Figure Out If Today Is 1st, 2nd, 3rd Thurs Of The Month?


My brain is frozen on a convenient way to figure out if today is the
1st, 2nd, 3rd, 4th, or last Thursday of the month. Basically I need
something that will figure this out for any given day for any given month.

date() has everything BUT a 0-5 return for this.




View Complete Forum Thread with Replies

See Related Forum Messages: Follow the Links Below to View Complete Thread
Figure How Many Full Weeks Are In A Month
Im trying to figure how many full weeks there are in a month and then
get the third full week dates?

Previous/Next Links As Month Names To Sort Listing By Month
I'm trying to build an event listing and realized that simply having previous and next buttons wasnt the best solution. Rather, I'd like to show the events by month and have the other month's events shown by following a link that would actually be the previous months name and next month name. Code:

Convert Date() Month Numeric Into Month Full Name.
date("m"); returns the following result for this month... "02"

That is fine and dandy, but the problem is, I need to change 02 into February, and not by changing it to date("F"); I need to use the date function to convert the supplied number of 02 into February, is there a way of going about this logically without a bunch of if/else statements??

Selecting Current Month In Month Select Dropdown
I have set up a simple dropdown to list all the months a year from now and for the past year, so form July 2006 - Jun 2008. However, I am looking to have the current month as the selected option when the user first sees the page. Any ideas on how to do this? Code:

Month Selection Dependant On Current Month
Basically I'm using a combo box to allow a user to select a month to see accounts stats for that month, so at the moment I am using the script below which will display all months up 1 less month than the current month (as obviously months after this do not have account details yet) However I want to allow the user to have a full 12 months to select from so if the current month was Feb 06 they could see Feb05, march05,April05.... up to Jan06... PHP Code:

Month Number Increases But Month Name Does Not
PHP Code:
for ($thisMonth = (int)$minMonth; $thisMonth <= 12; $thisMonth++) {
$monthName = date('M', strtotime($thisMonth));
print_r("thisMonth = $thisMonth and monthName = $monthName<P>");
}

Quote:
thisMonth = 7 and monthName = Sep

thisMonth = 8 and monthName = Sep

thisMonth = 9 and monthName = Sep

thisMonth = 10 and monthName = Sep

thisMonth = 11 and monthName = Sep

thisMonth = 12 and monthName = Sep

I am at a loss, please help, time sensitive I'm afraid, must be done in
an hour (it's 4pm EST now)

Month And Day Of Month Edit Fields
I wish to have a month select and next to it a day select.

Is there no way at all for the day field to pick up the selected month
without a previous submit on the part of the user?

Go (con)figure
I hope this is the right forum for this question. I noticed that i can take a php file that has include calls and header("Location: http://www.anyhost.com"); calls and on some servers it will work and on others nothing, absolutely nothing - like the statements aren't even there. Is there ONE particular setting in php that i should look for to correct this on the servers that they don't seem to work on?

Can't Figure Out The Error.
Here is some code I can't find the error in. I'm trying to fill a <select>
with option coming from a database, and would like to select a previously
selected record. For this, I set the value $City with the code selected
before. For testing purpose, I set the $City value to 0.
Now, I've 3 records in my table. ZIP fields are: 1950,1,a
When I run the code below, $value becomes "a".
That means that a = = 0; ??? but why ????

function showmessage($text){
echo("<script>alert('".$text."');</script>"); //debug function
}

$City = 0; //for testing purpose
$query_RSCity = "SELECT DISTINCT ZIP, Cityname From person where
person.IDType > 1;";
if(($RSCity = mysql_query($query_RSCity, $shopauto))){
while($QRow = mysql_fetch_object($RSCity)){
echo("<OPTION VALUE="".$QRow->ZIP.""");
if ($QRow->ZIP == $City){
echo(" selected ");
$value = 'test'
}
echo(">".$QRow->ZIP."&nbsp;".$QRow->Cityname."</OPTION>
");
if($value <> "")
showmessage("City: ".$City.", ZIP: ".$QRow->ZIP);
}
}

Trying To Figure Out Threaded Forums..
I'm trying to understand the math or 'how it works' with threaded posts and
such.

I'm using a MySQL table with like id's, subid, etc..

Can anyone point me in the right direction or give me a brief 'overview' on
how it works.

Been getting really confused and need a better way of doing it!

Trying To Make A Loop, Cant Figure It Out
im trying to make a little loop, but i cant figure it out... i
have a string with a bunch of 1s and 0s in it: 110101010101111010101
.... i need to count the number of 1s divide it by 2 and make a table
with 2 columns and then for every one, depending on its position in the
string i need to output a word and then go to the next 1 and output a
dif word....

its amenities, winter activities and summer activities for cottages
that i store in my db with 1s and 0s when its a 1 the amenitie or
whatever exists when its a 0 then it doesent exist...

Truncate A Decimal Pointed Figure Without Rounding ...
How can I get -0.162058 to -0.1 rather than rounding to -0.2?

I know I'm being stupid here, but it's really bugging me. The number before
the decimal point could 0 - 999

How To Create A Hidden Field Variable From An Echoed PHP Figure?
I have a PHP script on a shopping cart summary page that creates an invoice number and then echoes it to the page. This page, when submitted, will go to the shopping cart processor.

The echo portion of the script is working properly, it generates the number as intended.

My problem is that, not being very experienced in PHP, I want the invoice number not only echoed (which it is doing properly now), but also to populate a value in a hidden field that is submitted to the shopping cart processing page. My question is how do I populate the hidden field with the figure that is now being echoed in the script below?

The script that generates and echoes the invoice number is as follows:

<?php
echo "SA"; //department code
echo date ("mdy"); //date generator
// begin counter this reads figure from "count_file.txt"
if (file_exists('count_file.txt'))
{
$fil = fopen('count_file.txt', r);
$dat = fread($fil, filesize('count_file.txt'));
echo $dat+1;
fclose($fil);
$fil = fopen('count_file.txt', w);
fwrite($fil, $dat+1);
}
else
{
$fil = fopen('count_file.txt', w);
fwrite($fil, 1);
echo &#391;'
fclose($fil);
}
// end counter
?>

The hidden field is as follows:

<input name="Invoice_Num" type="hidden" id="Invoice_Num" value=" ">

I would like the value in the above to reflect the invoice number that is echoed by the above PHP script.

Looping Until Today
I want to loop through dates, stopping at the current date

I set the enddate like this
$enddate=date('Y-m-d');

which prints out as &#55614;&#57158;-04-01'

$l['cc_startdate'] comes from a DB with the column in date format

but when i do
for ($dl=$l['cc_startdate'];$dl < $enddate;$dl++)
{
print $dl;
blah

}

Today / Yesterday
What I am trying to do is show todays date as today and yesterdays date as yesterday. for example:

if ($row['postdate'] = date('Y-m-d') {
echo "Today";
} else if { ($row['postdate'] = date('Y-m-(d-1')[not sure of proper code yet still learning]);
echo "Yesterday";
} else {
echo $row['postdate'];
}

Record From Today 0 Time ()
I have the date stored using time () which produces an 11 digit long number which is then stored in the database as an 11 digit integer in an "int" field.

I'm just trying to work out how I can find all records from today according to their int time value.

Today, Yesterday And Tomorrow
OK, have a problem with setting variables that will change automatically for $today, $tomorrow and $yesterday....when I do a search by a MySQL date (20011008) it works, but I have tried multiple ways to set those variables, with no luck.

I either need help solving this problem, OR.....is there a way to simply go by NOW and use items before and after now? That would be a workaround that I could manage.

I Can Get Today In A Number Variable Out Of 365?
Is there a way I can get today in a number variable out of 365?

I'm not sure if that makes sense, so example:

January 1 would be 1

December 31 would be 365...

How Do You Select All Records After Today?
I want to select records from the database using: PHP Code:

All Records From Today Using Time()
I have the date stored using time () which produces an 11 digit long number which is then stored in the database as an 11 digit integer in an "int" field. I'm just trying to work out how I can find all records from today according to their int time value.

Get All Entries From Today (mysql)
I currently have a page that each time a user visits it, the pageid and timestamp is thrown into a mysql daabase.

so the database looks like so:
linkid time
3 2007-08-22 17:26:21
3 2007-08-20 17:26:21
3 2007-08-22 18:36:59
2 2007-08-22 18:37:21

What i need is for php to show the total amount of visits today as per a certain time zone (or if thats not possible, the past 24 hours)

soo..
Search for all occurrences where linkid = 3 today for a specific timezone (or 24 hours)

MORE SPECIFICALLY
User 1: Lives in New York (EST -5)
registers for my site and sends visitors to his linkid (3)

After two days, this is what the mysql table looks like:
linkid time
3 -=- 2007-08-22 17:26:21
3 -=- 2007-08-20 17:26:21
3 -=- 2007-08-22 18:36:59

But mysql time isn't Eastern time, its another timezone. So when a visitor comes to user1's page at 3pm EST, mysql registers the time as 2007-08-22 17:26:21

So... I want to first add/subtract the number of numbers in the mysql database depending upon the user, and then see the amount of visitors for the day.

Checking TimeStamp Against Today
How can I check if a date/time unix timestamp in the format of:

$mytime = "1186439997";

Is within 5 days of the current unix timestamp? Basically I need to check if the passed in timestamp was generated within 5 days of today?

Today.php Test Error. HTTP Headers
Trying to install on xp pro with IIS. Have mysql working. I tested it with the tutorial for installing from this forum.

When I open the test script, today.php I get
"The specified CGI application misbehaved by not returning a complete set of HTTP headers. The headers it did return are"' and theres is nothing after that but a black page.

The today.php consists of

<HTML><HEAD><TITLE>Today's Date</TITLE></HEAD><BODY><P>Today's Date (according to this Web server) is<?php
echo( date("l, F dS Y.") );
?></BODY></HTML>

Ive been over and over the php.ini and my.ini and cant figure it out.

PHP Scripts To Diplay Items From XYZ Date Til Today
I'm trying to work out the SQL command script to display all items from a fixed time period til the current date.

Something like...

$sql_query = "SELECT * FROM mytable WHERE dateAdded like 'todays date - 60 days'";

MySQL Dont Show Older Than Today
I'm making a database for upcoming shows. so, what I wonder now, is there a way to show only upcoming shows, and just exclude the shows older than todays date? what I've got atm is: Code:

Expired Article - Comparing Today To Expire Date
On my front page I have a list of articles that are pulled from my database. I have just added a column (expires) to the db in order to remove outdated articles.

I'd like to compare today's date to the expires date in my WHERE statement to exlude all articles where the expires date is older than today. But I'm at a loss right now on getting it to work.

How Do I Figure Out The "full Path" To My Directory
I'm running a script at the moment that requires the full path to my directory.

How do I figure this out?

Sort Results By Date/time, Limit 5 Database Entries Of Today &/or Upcoming Days
I'm designing a website for my fraternity and in the database I have entries which contain past events, todays events, and upcoming events.  My problem is that I can not figure out how to sort the query results to display:
 
1) only past events based on the CURRENT DATE
2) only the events which fall on the CURRENT DATE or after, limiting the results to 5 entries
3) all events that fall on CURRENT DATE or afterwards

Example:   
Today is  September 15, 2007

Problem 1) Displaying all events that happened before September 15, 2007
Problem 2) Displaying only 5 results that fall on September 15, 2007 or after
Problem 3) Displaying all events that are happening on or after September 15, 2007

And obviously I would like the CURRENT DATE to change depending on what date it is, currently.

Ok so now I've been very redundant in my explanation of my problem here is the code and a link to what that particular page looks like. Code:

Get Last Month
How can i know what is the last month..? or even how can i know what is month three months ago..

How Many Day In That Month
Is that any function in php or mysql that we can know how many day in the month?

Getting Age With Month
I need to get accurate age of user with month from date of birth stored in
mysql

date is stored in mysql like this 1983-05-05 and i need to show age like
this 23 year 11 month

I have calculated years but months are not calculating correctly

can anyone give some example how to calculate exact year and month.

Last Day Of Month
I want a function to determine the last day of the month. The function must actually calculate a date minus X amount of months (the months won't be more than 12 months)
I've got the following: PHP Code:

Last Day Of The Month
I am developing a calendar. How can I get the last day of a month.. mean which days is it Sunday, Monday or. it should be in numeric form Like Sunday is 0, Monday is 1... etc.

Getting The Month
Is there a function that gets the numerical value of the month?

Getting Last Day Of Month
I am trying to create a dynamic date that returns the last day for a month, depending on the month. PHP Code:

Getting First Day And Last Day Of Month
Hi, Using PHP 4, if I have a date, what is a function I could use to
give me a date that represents the first day of that month? For
example, if my date were "3/19/2006 8:00", I would want my function to
return "3/1/2006 8:00". Similarly what function would I use to return
the last day of the month? In the above example, the output I would
want returned is "3/31/2006 8:00".

First Day Of The Month
Anyone know how to tell what the first day of the month on (Sunday - Saturday)?

Last Day Of The Month?
Im having to do a bit of string manipulation and with the given values I need help trying to find out the last day of the month...

Im passing the date format of: yyyymm (200706 being this month)(and im unable to change this for several reasons) and Im using substr to find the first 4 chars as the year and the last 2 chars of the month. With these two values I need to find the last day of the month (in this case last day of this month would be 30)

At the end I then do an sql query where timestamp>=yyyy-mm-01 AND timestamp<=yyyy-mm-dd (where dd is the last day of the month value im trying to find.)

Any ideas with the above issue?

Number Into Month With St,nd,rd,th
Is there a shorter faster way to do this...? PHP Code:

Timestamp + Month
I have a Unix timestamp and i want to add 3 months to that time and return the result as a Unix timestamp. How do i do that?

Week Of The Month
I need to determine the week of the month (1-5) so I can rotate menus for a cafeteria.
Is the following, which I know prints the week rather than storing it, the simplest or easiest way to determine the week? PHP Code:

Caluclating Nth Day Of Month
I have a site where a meeting date is posted and that meeting always meets the First Monday of the month. What I am trying to do is calculate if it is the first Monday or not and print something like "The next meeting is Monday, August 7, 2006" and so on for each month of the year. I can do almost anything with phps date functions except that.

Month Difference
I am trying to work out the difference in months between 2 dates.

First Day Of Month From Sql Date.
If I have an sql date, such as "2006-11-19" is there a way using either
sql or php date and time functions to get the date of the the first day
of the month ?

Month Validation By Name
im trying to validate whether or not a proper month name was entered in a form
heres my script (does not work) the variable $birthmonth refers to a month by name, i.e. November, October, etc.

<?php
  if (date("n", $birthmonth) != range(1, 12))
  {
    $errormsg = 'You have specified an invalid month of birth';
  }
?>

Function To Get The First Day Of The Month ?
What function to use to get the first day of the month ?

Report By Month?
how to make report by month? i want to call out from my db but how to make the weekday function and also holiday?

Check Date From Input Must Greater Or Equal Today Date?
I have 3 select box. Code:

<select name="day">
<option value="1">1</option>
<option value="2">2</option>
.......
<option value="31">31</option>
</select>

<select name="month">
<option value="01"> Jan </option>
<option value="02"> Feb </option>
.....
</select>

<select name="year">
<option value="2002">2002 </option>
<option value="2003">2003</option>
</select>

When I select and click submit in form. I will have 3 variable :

$day, $month and $year

How can I check the day that I choose in form must equal or greater than today date? If it less than today date. I must print error message to user.

Count The Hits From Different IP Each Month
I have a table (url) which counts the number of hits of my sites for each month. Now I want to know how many hits from each IP address for each month. How should I design the table? I want to design the table (IP)which contains 13 columns, the first one is IP, from the second to thirteenth, each column is for a month from January to December, but it is redundant since the url table already has the month columns. What is the efficient way to design the IP table?


Copyright © 2005-08 www.BigResource.com, All rights reserved