FRIHOST FORUMS SEARCH FAQ TOS BLOGS COMPETITIONS
You are invited to Log in or Register a free Frihost Account!


How to get result for this week





AOP Web Development
hi do you have any idea how to get the result for sql for this week so if today is tuesday. i want to get the result from sun-tue or what ever the current day within the week..

thanks
Peterssidan
How do you store your timestamps?
AOP Web Development
date time format
rvec
Code:
$next_week = date(o-m-d H:i:s, time()+7*24*60*60);
$query = "SELECT * FROM table WHERE date<'$next_week' AND date>'NOW()'";
AOP Web Development
thanks for your reply but its what i need is to display the result which is covered from the 1st day of the week till what ever the current day within the week. so we assume that the first day is sunday so if today is thursday so the result will display should from sunday to thursday...
rvec
Code:
$week_start = date('j')-date('N');
$start_stamp= mktime(0, 0, 0, date("m")  , $week_start, date("Y"));
$start = date(o-m-d H:i:s, $start_stamp);
$query = "SELECT * FROM table WHERE date<'NOW()' AND date>'$start'";
AOP Web Development
thanks for the replay mate...
Related topics
Get week number from date
Long Week, Long Day
Gates: 'Information overload' is overblown
Why use IE?
The Unofficial Jokes Thread
Just a suggestion
Proper Floppy Disk care
A has no emanative letter:
Scam?
Me Thinks....
How to get your dynamic PHP website crawled better by se ?
help~~~~~`
Justification for War in Iraq
Goin' belly up
Reply to topic    Frihost Forum Index -> Scripting -> Php and MySQL

FRIHOST HOME | FAQ | TOS | ABOUT US | CONTACT US | SITE MAP
© 2005-2011 Frihost, forums powered by phpBB.