date of the first day from a given week number

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
nickel
Forum Newbie
Posts: 2
Joined: Tue Jun 10, 2003 12:56 am

date of the first day from a given week number

Post by nickel »

Hi peps.

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.
I appreciate every singel answer I get.

signing out; nickel.
User avatar
deejay
Forum Contributor
Posts: 201
Joined: Wed Jan 22, 2003 3:33 am
Location: Cornwall

Post by deejay »

I'd start by having a look at calendar scripts in hotscripts if I were you. http://www.hotscripts.com/PHP/Scripts_a ... index.html . sorry i can't help you more, its not something i've had to do.
[]InTeR[]
Forum Regular
Posts: 416
Joined: Thu Apr 24, 2003 6:51 am
Location: The Netherlands

Post by []InTeR[] »

In most script you will have to give the date, or timestamp to the function.

I have never seen a function that caculates the date or timestampt from a weeknr.

Maybe you can mail php.net to extend the Date and Time functions.
nickel
Forum Newbie
Posts: 2
Joined: Tue Jun 10, 2003 12:56 am

Post by nickel »

Well, I was more thinking about write my own function, since is doesn't exist one.

The problem is I don't know where to start.. I've also been looking on some other calendar scripts but could'nt find anything usefull.
User avatar
twigletmac
Her Royal Site Adminness
Posts: 5371
Joined: Tue Apr 23, 2002 2:21 am
Location: Essex, UK

Post by twigletmac »

This shouldn't be too tough if you're using timestamps. Using the date() function you can work out what day of the week your date is on and then you can subtract however many days you need to get Monday's timestamp.

Mac
Post Reply