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.
--
Sugapablo - ru***********@stargate.net http://www.sugapablo.com | ICQ: 902845 2 2958
Sugapablo wrote: 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.
Uncoded, but the logic would look something like
Get whatever today's date is.
Divide by 7
In a non-whole result, round up to the nearest whole number.
That is the iteration of that day in that month.
joe t.
Sugapablo écrivit: 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.
Try this:
$day1=mktime(0,0,0,date('n'),1);
$w=strtotime('this Sunday',$day1);
$weekn=floor(time()-$w)/(7*24*3600));
if(date('w')>=date('w',$day1)) $weekn++;
return $weekn;
--
P'tit Marcel This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Ian Bicking |
last post by:
The Chicago Python User Group, ChiPy, will have its next meeting
on Thursday, December 9th, starting at 7pm. For more information on
ChiPy see http://chipy.org
Topic
-----
This month's...
|
by: Unigroup of New York |
last post by:
Content-Type: multipart/mixed;
boundary="------------C465DF38DCB38DD2AF7117E0"
Lines: 327
Date: Tue, 15 Feb 2005 23:36:38 -0500
NNTP-Posting-Host: 24.46.113.251
X-Complaints-To: abuse@cv.net...
|
by: peashoe |
last post by:
I have an asp page that uses a calendar.js (pop-up) file to add an
exact date format in the text field (txtDDate). My problem is I need
some javascript that sets an alert that does not allow them...
|
by: François Laroche |
last post by:
hey guys,
I need help with a script:
<script>
var dayarray=new Array("Dimanche","Lundi","Mardi","Mercredi","Jeudi","Vendredi","Samedi")
var montharray=new...
|
by: lwoods |
last post by:
I want to calculate and display the 'mm/dd/yyyy' that is 10 years earlier
than today.
How do I do that?
TIA,
Larry Woods
|
by: bray |
last post by:
Learn, share, and have fun at ChiPy's Monthly meeting this Thurs,
April 13 at 7pm.
This is sure to be our best meeting yet. Confirm your attendance:
mtobis aat gmail doot com with "ChiPy April"...
|
by: Bill |
last post by:
Hello --
I'm parsing the output of the finger command, and was wondering
something...If I'm given a month abbrievation (such as "Jan"), what's
the best way to figure out the month number? I see...
|
by: crane.jake |
last post by:
Hi, I'm trying to find the following information from the table found
bellow.
Year_Sales - # of sales that have occurred this year
Year_Income - SUM(amount)
Month_Sales - # of sales that have...
|
by: engloon |
last post by:
i'm using vb.net to perform some checking.
i want to compare a set of data from database with today's month and year. i keep
the data from database as datatable and i let a string to save today's...
|
by: taylorcarr |
last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
|
by: ryjfgjl |
last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
by: Sonnysonu |
last post by:
This is the data of csv file
1 2 3
1 2 3
1 2 3
1 2 3
2 3
2 3
3
the lengths should be different i have to store the data by column-wise with in the specific length.
suppose the i have to...
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
| | |