[PHP-DB] making my own week? :)

2003-01-15 Thread Matthew Nock
Hi All,

I am currently building a website for a cinema - and a cinema week runs from Thursday, 
to Wednesday.

I need some help with how to get PHP to work with one week periods, but having the 
week starting on a Thursday, instead of Sunday, or Monday.


The week will be used to generate dynamic list boxes, and database queries...  

Anyone done anything like this before that may be able to shed a little light? 

If anyone is experienced with this sort of date manipulation let me know what info 
you need and I will provide it where possible.

Cheers,


Matt



Re: [PHP-DB] making my own week? :)

2003-01-15 Thread Ignatius Reilly
The simplest seems to store the date normally in the DB.

When you need your special Cinema date, just do a modulo 7:
myDayOfWeek = ( WEEKDAY( '2003-01-17' ) + 3 ) % 7

HTH
Ignatius

- Original Message -
From: Matthew Nock [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Wednesday, January 15, 2003 11:45 AM
Subject: [PHP-DB] making my own week? :)


Hi All,

I am currently building a website for a cinema - and a cinema week runs from
Thursday, to Wednesday.

I need some help with how to get PHP to work with one week periods, but
having the week starting on a Thursday, instead of Sunday, or Monday.


The week will be used to generate dynamic list boxes, and database
queries...

Anyone done anything like this before that may be able to shed a little
light?

If anyone is experienced with this sort of date manipulation let me know
what info you need and I will provide it where possible.

Cheers,


Matt



-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




RE: [PHP-DB] making my own week? :)

2003-01-15 Thread John W. Holmes
 I am currently building a website for a cinema - and a cinema week
runs
 from Thursday, to Wednesday.
 
 I need some help with how to get PHP to work with one week periods,
but
 having the week starting on a Thursday, instead of Sunday, or Monday.
 
 
 The week will be used to generate dynamic list boxes, and database
 queries...
 
 Anyone done anything like this before that may be able to shed a
little
 light?
 
 If anyone is experienced with this sort of date manipulation let me
know
 what info you need and I will provide it where possible.

I think it's all kind of specific to what you want to create. 

If you want a drop down box filled with dates from the past Thursday to
the next Wednesday, for example, you can find the date of the last
Thursday with strtotime(last Thursday), I think. Figure out how many
seconds are in a day and make a little loop that adds the seconds to
what you got from strtotime() and uses date() to format it. 

What database are you using? There are many functions that most
databases provide that can help with this, too.

---John Holmes...



-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php