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.





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 Complete Forum Thread with Replies

Related Forum Messages:
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

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

View Replies !
Wrong Week And Year Combination
I've got a date: 1136123520, which is "January 1, 2006, 1:52 pm". Now i do: Code:

date("W", $lastdate)."_".date("Y", $lastdate)

The result is reallllly strange: Code:

52_2006

The exepected result should be: Code:

52_2005

Is this a bug in php or am i'm missing something here? I'm currently using php 4.x and can't upgrade to php 5.

View Replies !
Timestamp Problems - Week Of The Year
im developing a script that uses a calendar for appointments. id like to be able to find all appointments in a particular week of the month. here's my code, all was working fine until it got to october 2002.??? Code:

View Replies !
MySQL: Going From Week Of The Year To Date Of The Monday
So I know how to get the week of the year from a date.

What I want to know is if there is a way in MySQL to get the date of the Monday of a week specified by a week number.

For example, I have a bunch of items in a database with dates. I know how to tell the database to get only the items that occur in, say, week 5 of the year, but how do I get the date of the Monday of that week?

I found a way to do it in PHP but for performance reasons I wanted to know if it's possible inside the MySQL statement.

Also, as an aside, is it possible to assign a value to a "variable" in a MySQL statement (e.g., select something AS somename) then use that as an argument later in the statement?

View Replies !
Converting A Year/week Number Into Timestamp
I would like to convert a year (2005) and week number (1-52) into a unix timestamp. Has anyone got any idea how to do this in MySQL?

View Replies !
Date That Is Formated With The Week Number Of A Year. Date("W");
I have a date that is formated with the week number of a year. date("W");

this defults as monday being the first day of the week. Is there anyway I can dynamicly set which day I want to be the start of the week?

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

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

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

View Replies !
Date Plus 1 Year
I am writing the date to my database and would like a second field exactly 1 year from the date that row was created, i am using timestamp(6) for the date which is fine, but for the future date i dont really want timestamp because the rows get updated and consequently the dates. It is basically a membership scheme with one years use of an item so the second date will be the end of the subscription. Or possibly some other way round the problem.

View Replies !
Month Year
I am providing a drop down list to the user with values such as

Oct-2004
Nov-2004
Dec-2004
n so on
if the user selects nov-2004 the month november n year 2004 should get stored in my MySQL database.(precisely which data type should i use to efficiently store month as well as year? However if the current month is november the drop-down should not contain options such as october or september. How do I do this?

View Replies !
Year In A (****) Format
(1950)
(1975)
(2000)
(2001)

etc etc

This sort of year will be somewhere in a one line string . How do i search for a year like this thats between 2 curved brackets. While i could use strpos to find the first curved bracket then then check if theres a ) five letters along. some sort of wildcard method would obviously be much better .

View Replies !
Same Day Last Year Problem
Today is Thursday 16-Feb-06. The same thursday last year is 17-Feb-05. Because I am comparing daily sales between years, I need to know the date of the same weekdayname as last year, so that I am comparing Saturdays with Saturdays, Sundays with Sundays, etc

ie, 16-feb-06 goes to 17-feb-05
28-july-06 goes to 27-july-05 and so on

I have tried all sorts of dateadd(&#55614;&#57156;-01-01'...etc, and I am all out of ideas.

View Replies !
Select Year
How do I select a year if my date field is stored "yyyy-mm-dd". I tried the below and no records show. WHERE daysOff.dayOff= YEAR(&#55614;&#57159;')

View Replies !
YEAR Database
I have a search I've created for a database. One of the options is to search by year &#55614;&#57158;',&#55614;&#57157;',&#55614;&#57156;', etc. The page: search.php?year=$year&news_category=$news_category isn't working if they leave the year blank. The first option in the drop-down form for news is set to value="". What I would like to do is if they select the value="" option for news to display all results, regardless of year, where news_category=$news_category My query is.

SELECT * FROM news WHERE YEAR(news_date)=" . $_GET['year'] . " AND news_category = " . $_GET['news_category'] . "

View Replies !
Mysql Year
Datatype Category: DATE/TIME Datatype Info: A year in 2- or 4-digit format (default is 4-digit). The allowable values are 1901 to 2155, 0000 in the 4-digit year format, and 1970-2069 if you use the 2-digit format (70-69). MySQL displays YEAR values in YYYY format, but allows you to assign values to YEAR columns using either strings or numbers. (The YEAR type is unavailable prior to MySQL Version 3.22.) See section 6.2.2.4 The YEAR Type. The above is about mysql year type.

So if I input the value is run say 1800, it will give me the 0000 even I set up the default value of that field (type: year) to be NULL. So for a valid year value, I need to test the range either "1901"<$input<"2155" "00"<$input<"99", otherwise, I will set it to NULL. Then I will not have the "0000" shown in my year type field.

View Replies !
Group By Year
I have a list of items in a db that has a date stamp column in the following format 0000-00-00. The list is getting long so I would like to out put the year first, and ask the user click the year to see the items for that year only. How do I scan my table and output the years only? Is it something like: PHP Code:

SELECT DISTINCT YEAR(my_date) FROM mytable DESC.

View Replies !
Changing Year In Php
I recently purchased a ladder script and the problem is, the "Match Scheduler" shows the year as 2003/2004. I asked the owner of the script and I was told to edit the .php file that contains this information, but when I looked in it, I saw nothing that showed 2003 or 2004. Is there something I'm missing? I've included the.

View Replies !
Change Of Year
I have a script that pulls content for CURRENT month and PREVIOUS month from db.

Now, it only considers current month two weeks into the month. So if today is Feb. 1, it'll use January as CURRENT MONTH, but if it were Feb. 15 it'll make FEB a current month. To get the right content I need a MONTH ($checkMonth) and YEAR($currentYear).

Everything worked fine until the year change and moths started going from 1 again and the previous month became 12. I am lost as of now trying to untangle my own mess. I'm sure it all can be simplified a lot! I'm at your mercy, here's what I've got: Code:

View Replies !
Run Year In Loop
PHP Code:

Date of Barth :: &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                          <select name="RegYear">
                                <?php
                                    for ($i=0; $i<=100; $i++)
                                    {
                                        SelectedYear="";
                                        range (1900,date("Y"));
                                    }
                                ?>
                          </select>


View Replies !
Grouping By Year
I am having a hard time figuring this one out. I have a database of information that one column is a timestamp. I want the information displayed in groups by year, then month and date like:

2006
-9/16
-9/15
-8/3
2005
-5/14
-4/10

View Replies !
Year Months
<h3><?php echo $arrl["Byear"]; ?></h3>

<ul class="rlinks">
<?php for($i=-3;$i<2;$i++) { ?>

<li>
<a href="agend_desporto.php?modifier=<?php echo($i); ?>"><?php echo(trata_month(date(m)+$i)); ?></a>
</li>

<?php } ?>
</ul>

and I want to separate the months for years if necessary. How can I do this?

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 !
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 !
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 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 !
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 !
Leap Year Calculation
how can i incorporate leap year also at my below codes PHP Code:

View Replies !

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