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




Week Of Year


Is there a function which returns the week of the year, given a specific date?




View Complete Forum Thread with Replies

See Related Forum Messages: Follow the Links Below to View Complete Thread
Check Week Number In End Of Year And Begiining Of New Year?
I am creating a little own calendar. Now I want to add a "previous week" and "next week" functionality to the calendar.

It is easy to take $thisWeek - 1; and $thisWeek + 1;, but there has to be a check wether it is the last week of the year and it should actually be a new year and head to week number 1. HOW do I make this kind of function? I use the following string names:

$thisYear
$thisWeek

Starting A Year Loop With Last Year
I have the following which loops through the present year and adds two more years on: However, I want it to be exactly the same but to start from last year rather than this year. Is this possible? Code:

Day Of Year Count
I have a script that reports that day on which a post expires as: 2000-06-12. What i would like to do is post it instead as: Expires in: 11 Days. So basically, I'm looking for a PHP3 way to do a Day of year Subtraction. I know with MySQL its:

(TO_DAYS(Expires) - TO_DAYS(Current_Date))

is there a way to do it without going back into MySQL, using PHP3? OR how to i configure my Select so that it will automatically output "Expires" date as a the day count UNTIL expires.

Last Day Of Year Date Bug?
Guys, the line below just returned "Dec 07" as the date for one month
back from today. Hardly life-threatening, but any thoughts?
<?php print date("M `y", mktime(0, 0, 0, date("m")-1, date("d"),
date("Y")));?>

AS...

Leap Year Calculation
how can i incorporate leap year also at my below codes PHP Code:

Getting Month And Year From A Date
Using PHP 4, how would i Extract the numeric month and year from a date
variable created using the date() function?

Need Date For Every Monday Of Year
Is there a way to get the date for every Monday for a particular year and have it populate a drop-down box? Need something to start by.

Calendar Displaying A Whole Year?
I'm reasonably new to php and have been looking everywhere for tutorials on creating calendars. I've found so many, but they're all relatively the same, where they only display one month at a time. If anyone could point me in the direction off a tutorial where I can create a calendar to display a whole year in one go, instead of one month that would be absolutely great.

I'd quite like a tutorial instead of a simple download, because I can learn more by going through it all. I don't need any fancy stuff like events. It's litterally just a calandar with nothing on it but the dates.

Date() With Leap Year
I am using this function below in a script to create a count down script.

<? date(("z"), time() - (14400 * 1)) ?> My question is; does the "z" (0 - 365) go up to a maxium of 366 when it is leap year?

Dynamicaly Display Month And Year
Hi how can i display month and years dynamically without using database in a drop down menu.

<select name=month>
<option value=1>January</option>
<option value=2>February</option>
...
</select>

Also the year drop down since 2003 value will be added with every year ie in 2004 it shd show:

<select name=year>
<option value=2003>2003</option>
<option value=2004>2004</option>
</select>
and so on..

Any help?

Selecting Year & Month From Timestamp(14)
What I'm trying to do is create a link to a page that displays the headings of articles from a previous month of the year. The link will be something like <a href="/prevnews.php?yearmonth=$var"> and then on the page I will query the database with a line like:

SELECT * FROM table WHERE TimeEntered=$var

My problem is, I don't know how to select all columns from a table where the year and month are whatever I specified in $var. My TimeEntered column is timestamp(14), so YYYYMMDDHHMMSS. If I could just get the YYYYMM part, that would be fine. How do you do that? Also, I run this query on the page. Could I somehow use the variable fDate to get the YYYYMM ? PHP Code:

Populating A Drop Down List With The Year
i'm trying to loop the years from 1960 - 2010 with the function get_year() below:
PHP Code:

Can't Get Month Year From Variable Using Date()
I have a very simple question about date(). I am using date('l, F d, Y'); to show Tuesday, August 22, 2006. But now when I am trying to display just Month - Year i.e (August - 2006) from variable, Its not coming through and displaying January - 1970.

Code: I have done date("F - Y", $entry_date) for this. Can any one just point me out or suggest where I am wrong here?

Exclusive REQ: PHP Developer In Sunnyvale, CA - 1 Year
We have an exclusive requirement for PHP Developer in Sunnyvale, CA. I
can get the interview with in 1 hour and PO by end of the day. There is
no client interview for this position. Please forward updated resumes
with contact info, expecting rate ASAP.

Interview in 1 hour, PO by end of the day

Location: Sunnyvale, CA
Duration: 12 Months
Start: Tomorrow
No of needs: 5
Rate: $Open/Hr
Client: Yahoo

Required Skills:
·3+ years of PHP Development experience
·UNIX or LINUX, My SQL, Apache, Java Script
·HTML, DHTML, CCS
·Web Applications experience is a plus
·Candidates, who have worked with search engines like Google, Yahoo
will be of great help, though it is not mandatory
·Should have excellent communication skills

Printing Full Year Calendar?
I use a calendar script, Keith Deven's PHP Calendar. I've modified it to incorporate events into it and everything works great. The problem I'm having trouble with is when I print the year long calendar. For some reason it only reads the dates in the database for the current month, in this case March and it outputs the same days for every single month. Code:

Search Data Between Two Specific Year?
I have tabel called "candidate" in that i have two fields call Graduation Passing year and Post Graduation Passing year. In that table i have more than thousands number of candidate. Here i want to make a search php form. Where i can get data of specific candidate who pass between specific year.

I have make a form for search with below fields: Graduation Candidate search : Year From and Year To fields and submit button to call query form and display result. Code:

Converting MySQL Date To PHP Day Of The Year
i was wondering if anyone knew if there was a way to convert a MySQL Date (yyyy-mm-dd) to a PHP day of the year

date(z);

as in like January the first would be day 1 (or 0 )

Date/Time Column, Accessing Only Year
I'm trying to generate a table that gives some statistics. I've got a date time
column that registers hits. I need to calculate the number of hits for 2006 using the 'date' column, which is the date time column.

Select Distinct Year From Unix Timestamp
I'm trying to select all distinct years from a unixtimestamp field in
MySQL database. I have a query:

SELECT DISTINCT YEAR(date_field) As theYear FROM table

but it gives me an empty array. What am I doing wrong?

List Weeks Of Year Using Calendar Function
I've been asked to design a small site which contains a page with a list of dates to show a visitor if accommodation (running from Saturday - Friday) is booked or available. Something like this:

2007
2nd Jan - 8th Jan  -  Available
9th Jan - 15th Jan  -  Available
16th Jan - 22nd Jan  -  Booked
23rd Jan - 29th Jan  -  Available
5th Feb - 11th Feb  -  Available
12th Feb - 17th Feb  -  Available
etc, etc

I'd like to dynamically create the list of dates using the php calendar functions and a mysql database so that each row (52 in total?) could be flagged 'booked' or 'available' allowing easy updating using a back end form. Ideally the page showing the list would have a link taking the visitor to another page showing the following year's dates. Each list would always show a year to view and always run from Jan to Dec.

Joomla :- RSGallery Problem :- How To Add Parameters For Images (like Price , Year Etc)
I am using RS Gallery.I want to give/add  different parameters to each image (like price , year etc). Is there any way to do this? If yes Please send me the solution.

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

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...

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.

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.

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.

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?

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.

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.

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:

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.

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.

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?

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.

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:

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.

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.

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.

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?

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?

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.

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.

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.

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.

Date Function For Week Before
Im looking to get the date of a week before a certain date For example:

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

This is for a week ahead, how do I do a week before?

Week Ending Dates
When a user logs on, he should have a drop down selection box of week ending dates that would include any week ending dates that he hasn’t completed time for, only going back as far to a specified date and then also the current week he is within and up to 1 week forward. The week ending dates should always be on a Sunday. The table I have is as follows;

CREATE TABLE `techs_pay_weeks` (
  `tech_pay_week_id` int(11) NOT NULL auto_increment,
  `tech_pay_week_ending_date` date NOT NULL default '0000-00-00',
  `tech_id` int(11) NOT NULL default '0',
  `tech_pay_week_hours` float NOT NULL default '0',
  `tech_pay_week_amt` float NOT NULL default '0',
  `tech_pay_week_approved` tinyint(4) NOT NULL default '0',
  PRIMARY KEY  (`tech_pay_week_id`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;

The tech_id is held as a $_SESSION[userid] when he logs in. I understand how to advance a date, but not from a dynamic date that should always fall on a Sunday, and a current Sunday at that.

Constraint Using The Days Of The Week?
I am developing a property application where I have 5 members and only want 1 member a day to choose their property for the "property of week" section.

So I want to assign a day to each member.

Mem1 - Mondays
Mem2 - Tues
Mem3 - Wed etc..

Each member will have there own unique logon so if Mem1 logs in on Monday, they will have the "property of week" option avaliable to them. Mem2 will have it Tuesday and so on.

Work Out Day Of Week From Given Date
I'm using a date picker to choose a date. the format of the date entered into the textbox is yy/mm/dd

From this how can I work out the day of the week from the entered date? I need this as the first day has to be a sat, and if it isnt my form will tell the user to choose a saturday.

Is there a simple way of doing this?

How To Remove Entries In A DB That Are A Week Old?
I ahve a social network and I have a bulletin system, taht allows users to post bulletins that all their friedns can read... well anway, i dont want the bulletin to just sit there and take up DB space, how would i go about removing "bulletins" that are over a week old?


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