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


SuperbHosting.net have generously sponsored dedicated servers to ensure a reliable and scalable dedicated hosting solution for BigResource.com.





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:




View Complete Forum Thread with Replies

Related Forum Messages:
Month From Week Number?
Has anybody here ever made or seen a function which when passed year and week number in that year returns month ?

actually what I want is all records from db starting from six months back till now and group them by weeks, and some weeks may have no record so they won't appear in resultset. But I have to display zero against these weeks.

display has to be in form of Number of Records in Week # x of Month y e.g Number of Records in Week 2 x of Month Jan So my solution is to get records from db by this query:
.. where abs(Week(Now()) - Week(RecTime)) <= 26

this works ok but I don't have any idea of which month and week of month was 6 months ago.
So I decided to get week number and year of 6 months back and then write my function get month form this info.

View Replies !
Group By Week And Month
I currently use this query to see a list of my order counts:

SELECT date, count(date) FROM orders WHERE 1 group by to_days(date)

I want to do the same thing, but instead of grouping by day, I want to group by week and month. Any ideas of how I can do this?

View Replies !
Getting Rows From This Week Or Month Only
I need to get the orders out of my database for statistics purposes.

For example I need to be able to pull out the orders for the following at any given time:

Last Weeks orders (A week is monday 00:00 to sunday 00:00)
This weeks' orders to date. (So monday 00:00 to date)

Last Months orders (Entire Month Just Gone)
This Month's orders to date

Last Financial Year's Orders (April 5th (Last Year) 00:00 to April 4th this year 23:59)
This financial year to date (April 5th this year 00:00 to date.)

Column is in DATETIME (01-07-2005 22:59:00) mysql datetime format

So what mysql query would I use and how would I create a drop down list with the corect variables in it for each of the above options?

View Replies !
Cronjob, Mail Every Week/2weeks/month
3 types of users. those that want e-mail every week, those that want it every 2 weeks, and those that want it every month. there's only one cronjob set for every week. so the every week e-mail isn't a problem. the way i figure. i need a text file to store the value PHP Code:

View Replies !
What Day In The Month Is The First Day Of A Week (based On Date In Querystring)
I really need to work out what day of the month the first day of the week is based on a date I pass through a query string.

At the moment I am able to work out what the first date of this week is using:

$day_in_month = date('d', strtotime('last monday'));

However, the documentation for strtotime is a bit weak and i'm not really understanding it. If I pass something like : 2006-12-24 00:00:00 through the query string, how can I find out what day in the month the first day of the week is (which should be December 18th)?.

View Replies !
Date Week Number And Month Number
i know there is a way to get the week number, as in 1-55 of the year, but is there a way to work out what month it currently is, from the week number?

View Replies !
Display For The Week Of (fridays Date Of The Week).
I have a report that people can access online and it generates data for a given week until friday. In the title and on the report, I want to display For The Week Of (fridays date of the week).

Instead of writing a huge if - then statement array - is it possible for to simply have an expression that figures out what day it is and then tells me Fridays date - has anyone ever done anything like this.

View Replies !
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:

View Replies !
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??

View Replies !
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:

View Replies !
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:

View Replies !
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)

View Replies !
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?

View Replies !
Strtotime("-1 Month") Returns Day 1 Of Current Month
I ran this code today (October 31st, 2006) expecting it would return `9/2006`

<?php
echo date("m/Y", strtotime("-1 month")); // returns 10/2006
?>

Instead it returned `10/2006` and upon further investigation strotime("-1 month") is actually just rolling back to day one of the current month.

<?php
echo date("m/d/Y", strtotime("-1 month")); // returns 10/1/2006
?>

I wasn't expecting this behavior, and it somewhat broke the logic of a "expired credit card" validation I had on one site. It's pretty disturbing that I completely missed this in testing. :/

View Replies !
First Day Of A Week
hi,

i want to know the range of date for a week

example : week 3 of 2001

monday is ??
sunday is ??

how can i do with PHP ??

tx

View Replies !
Day Of Week ?
Is there a way I can obtain the day of week - If I have the day, month, year ?

(not via the time function - But from a database....)

Im looking through the calendar and date functions -But can't locate
anything suitable...

View Replies !
Day Of The Week?
is there a way to get the day of the week in php? i want to get the correct values monday, tuesday, wdenesday, etc. for the actual day it is.

View Replies !
Day Of The Week
I'm looking for some code who return the day of the week from a date. For instance : May 18th 2003 --> saturday .

View Replies !
Getting Day Of Week Out Of Datestamp
I currently have a datestamp in the format yyyymmdd. I want to pull the day of the week (Monday, Tuesday, etc...) out of that datestamp at any given time.

Currently my code looks like this:
$datearray = getdate($firstdatestamp);
echo $datearray["weekday"];
When $firstdatestamp = 20000501 (or the first of May, 2000) the weekday returned is Thursday when really it should be Monday!

I tried:
echo date("l", time());
and it gives me the right weekday but only for the current date. I need to pass this my datestamp and am not too sure how.

View Replies !
Getting Day Of The Week From A Date
I tried searching the old postings, but to no avail. I am trying to figure out a way to get the day of the week from a date. Basically, I have a date in the format of 05/02/2003 (but I can change that format easily) and I need to have my program figure out which day of the week that was. All of the dates that I have will have already passed.

View Replies !
Date Of The Week
Can anyone help me? I am trying to work out the timestamp for the first DATE (not day) of the current week and last date of the current week. Any ideas?

View Replies !
Date To Week # Fct
I'm searching a PHP function that would translate a date in the following
format yyyymmdd to the week number in the year...
ex : 20040128 => 5
i.e. jan 28th 2004 gives week nb 5 in 2004.

View Replies !
Week Of Year
Is there a function which returns the week of the year, given a specific date?

View Replies !
Getting SQL Rows For A Week
I have a database that uses two date fields for tracking information. The first field is for the addition of the record and the second is for the expiration.

I have a small section that I want to list records that will expire in the current week (or for that matter in the next 7 or 14 days). What is the syntax that I would use to call mySQL with to get that info.

View Replies !
File Of The Week?
I wish to add an automated "file of the week" feature to a site for users to download.
I was having a little trouble explaining this.... So I ended up making these few points on the functions of the script I'm aiming for:

- The script finds the folder with the files for the current week. (If the download was a wallpaper, there would be files for different resolutions, and therefore more than one file.)

- Links are then made to the files.
- Every week, the links are updated for the new files for the current week.

I was thinking along the lines of putting the weekly files into folders named after timestamps and going from there... Is that the way to go? And how would it be done? I can't quite figure this out.

View Replies !
Printing Every Week
im trying to print a list of every Friday since a date defined. Let me try and explain. I want to define a date such as 2007-07-06 (which is a Friday) and then let php print each Friday since that date until today. For example, if the date defined was 2007-07-06 then it would print

2007-07-06
2007-07-13
2007-07-20
2007-07-27
2007-08-03
2007-09-14

But I want to also be able to format the date it outputs, so it might look like

Friday 06 July 2007
Friday 13 July 2007
Friday 20 July 2007
and so on.

View Replies !
Week Before Date
Im looking to get the date 7 days ago. I know how to do 7 days ahead:

$timeStamp = strtotime($oLastBatchDate->Last);
$timeStamp += 24 * 60 * 60 * 7;
$NextBatchDate = date("Y-m-d  H:i:s", $timeStamp);

However, does anyone know how to do 7 days back?

View Replies !
Date And Week
I am looking for a way to determine the week of the year if i have a date.i know that
date("W"); give me the week Number but not sure how to determine the week based on the date.

View Replies !
Day Of The Week Program
I am trying to write a program that will give me the day of the week without using the date function. I input the date and it's supposed to spit out the name of the day of the week. Here is what I have so far. I don't know quite what to do next. Code:

View Replies !
Get Dates Before From Last Week
<?php
//today date is: 2006-04-10 08:18:24
//last week is: 2006-04-03 06:23:10
$lastWeek=date('Y-m-d H:i:s', strtotime('-1 week'));
//How do I get any date before last week(2006-04-03 06:23:10)

//This show all date start from last week (2006-04-03 06:23:10) up to today (2006-04-10 08:18:24)
$result = mysql_query("SELECT * FROM $table WHERE dateCreate >= '$lastWeek'
//I want the opposite of this, from before last week, not from last week up to today.
?>

How can fixed the above code to get all dates in the database from before last week? Any idea?

View Replies !
Days Of Week
I'm attempting to display information for today, the next day and the day after (so only three days worth). The first day is hardcoded to say now. I want the next day and the day after to be the abbreviated day (ie. Tue, Wed and so on). The problem I have with the following code is that now and the next day are the same. Thus, I have now (which is Tue), the next day (which is ALSO Tues - wrong!) and the day after is Wed. Here's the include:

$return['mydata'] = array();
for($i = 0; $i < 2; $i++) {
$attr = explode('"', $this->tag('blm:mydata',$i));
if(count($attr) > 1) {
$day = array();
$day['when'] = $attr[1];
$day['image'] = IMAGES.$this->translate($attr[11]).'.gif'
array_push($return['mydata'], $day);
}
}
return $return;

And here's the front-end page:

echo " ".$stuff['mydata'][0]['when']."<br/>

View Replies !
Week To Date.
how i can make a week number to a date string. Ex. week 1 ---> 1 Jan. till 7 jan. Date format is not important.

View Replies !
Enddate Of The Week
Anyone knows how to get the start date and end date of the week. example theres (2007-11-19)- (2007-11-23) or Monday-Friday.

View Replies !
Select Last Week
Is there a 'proper' way to select items with a date belonging to the previous week? I have this -

SELECT n from table where YEARweek(a datestamp) = YEARweek(CURRENT_DATE - INTERVAL 7 DAY) && year(datestamp)=year(current_date) ...

I think the flaw with that will come during the first week of January? Is there a better way?

View Replies !
Days Of Week In App
recommend for a best approach to populating a Days-of-the-Week table in an event-scheduler app? in my particular case, each day of the week relates to a daily drink-special for a bar. i'm trying to figure out my order of dependencies. here's a snapshot of my tables

if i am going to add an event,i have to have it on a day of the week. that day of the week needs to have it's specials populated in order for it to exist in the Table. so, how should i go about "forcing" the Event Scheduler App User to first populate the Days-of-Week table so that when she adds data for an event, the dayys of the week will be available to input into the Event table?

View Replies !
Year Week
i´ve two variables the year and the week (2003 and 5) that means the 5th week of the year 2003. now i need the start- and enddate of the 5th week of year 2003.

View Replies !
Day Of Week (dates): How To?
I'm building a website and in the database i store all information. Visitors can add events to the database, with the date the event takes play.

Now, when in the database it says : 2006-01-01 i want it to show : monday january the first 2006 (something like that)my question is :

how can i see wich day of the week it is, depending on the day specification in the date from the db
AND
(optionally i don't know how it will be coded) how can i change the day 'wednesday' to 'woensdag' wich is the same day but in my language.

View Replies !
Finding The Day Of The Week
I know i can find the day of the week for today by doing:

$day_of_week = date("D",mktime());

But what if the date I want to find is not todays date but in a variable say current_date?

View Replies !
Getting Results For This Week
I have a table with a date field and I need to get the results for the next week.

Basicaly it's checking estimated completion dates and getting the results for jobs that are due within the next week.

Table looks like this
JobID-->Primary
EstimatedCompletionDate-->Date
Year
Make
Model etc...

I need to get a list that shows all estimated completion dates between today and 7 days from now.

I know how to check for jobs due today, but it's the 7 days from now that is throwing me off, especialy if the month changes.

View Replies !
Week Calendar
how to to build a events week calendar? This calendar should only display all the week of the selected year!!

View Replies !
Recurring Day For Every Week
I need a function which gives me the list of dates for certain weeks (date for every monday for 6weeks) I am not aware of built in functions of PHP.... any easier way to do it...? Code:

View Replies !
Week Query
I'm trying to write a myphp query which will show me same-day results for today's day of the week. therefor show Today and all previous tuesdays. I can get each order's day of week by using "DATE_FORMAT( b.statusdate, '%a')", but what is the syntax for making this show where equal to today's day of the week.

View Replies !
Date Of The First Day From A Given Week Number
I need some help to figure out the date of the first day in a given week number. Let's say that I pick week number 23, I want to retrive the day of that monday in week 23..

I've been searching the net for days without any result.

View Replies !
Datetime Within Past Week
I have a series of records in a database. When each record is stored,
the datetime is logged: $date = date("Y-m-d H:i:s");

Prior to adding a new record to the database, I want to run a query to
retrieve all of the records uploaded in the last 7 days. I thought it
would be easiest to:

Pseudo Code:
$newDate = $date - 7 days;
select * from TABLE where DATE $newDate;

Problem is I can't figure out how to subtract 7 days from $date and
convert that value to a valid datetime object.

View Replies !
Current Week Number
how I can split the month out into 5 weeks... then to have the week number printed and when the current week ends it will increment to the next week number. For example today is 3rd of July, therefore we are in week 1 of the month. Next week will be week two. I want it to go back to 1 at the start of the next month though.

View Replies !
Date Out Of Week Number?
I would need to get a date out of a week number, for example for week 52 the first date, 25/12. In my system the user inputs a week number, and then I would like to display a popup list of all seven dates for that week, for her to choose from. Is there a handy function to do this, or can you think of any way to achieve this?

View Replies !
Handling Week Number
I have been reviewing some calenders classes and have notice that if u
uses us written class with displays week number it ll by wrong for eu.
so to my question
how do you handle week numeration depenting on country? is there any
simple solutions for this?

View Replies !
Mysql WEEK() Function
In mysql WEEK() function it specify the number of week of a specific
date. For example January 02, 2006 will return a value of 2. Now my
problem is how could i be able to determine the range of that value in
a week like a value of 2 will be equal to January 1, 2006 - January 7,
2006.

View Replies !
309833 Web Views Last Week
This number seems about 30 times higher than normal for this group.

The group usually sees 10 times less traffic than the CakePHP group.

View Replies !
Delete Records Since A Week
I've been trying to delete records since a week and i'm not able to do it. Before with this script, i was doing so many things at a time and i was confused.But, now, i just displaying the records from a table N trying to delete them.Would somebody pls guide me.

I just wanna set the delete flag(i.e, i want to set the RBS_DELETE column to Y or something) when i check a check box to delete it. I've some 5 records displaying on my form and i want to check 3 of them and when i check them and hit submit, i want the RBS_DELETE column to have some value. PHP Code:

View Replies !
Strtotime - Use Abbreviations For Week
I'm pretty sure I used to be able to use abbreviations for week (w), days
(d), etc in strtotime (e.g. strtotime("-3d") = 3 days ago), but now it
doesn't work as expected unless I specifiy the whole word ("-3 days"). Has
anyone else come across this ?

View Replies !
How To Calculate The Day Of The Week By A Given Date.
I'm currently working on a (simple) calendar system which allows registered users to add an event to the calendar. The table EVENT stores info about the author, date and description of the event.

I then managed to output a list in which only events of this year are showed and are grouped together by months. And now I only need one more thing to complete the script. I want to output for every event on which day of the week it occurs (monday - sunday). I've looked around for tutorials but haven't found a basic one.

View Replies !

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