PHP and Date - Help me !!! :(
Posted: Mon Oct 06, 2008 5:49 am
Hi,
I am trying to achieve something with date, i hope at least this time i get some help
I am using three categories, contents in today date, yesterday date and tomorrow date.
I am saving date to variable to display in the web page.... pls check the following code
// To display today date
$today = mktime(0, 0, 0, date("m"), date("d"), date("y"));
echo( date("F d, Y", $today));
// To display tomorrow date
$tomorrow = mktime(0, 0, 0, date("m"), date("d")+1, date("y"));
echo ( date("F d, Y", $tomorrow));
// To display yesterday date
$yesterday = mktime(0, 0, 0, date("m"), date("d")-1, date("y"));
echo ( date("F d, Y", $yesterday));
Are above codes correct to save date in a variable? according to above codes date can be displayed, but i need to display content of the table Where date=today and date=tomorrow and date=yesterday respectively, so i tried the following but in vein.... Please help me with this regards and i also need to skip Sunday in between........
The following code used to display the content for table...... is it rite?
$sql="SELECT * FROM $table WHERE date=$today ORDER BY time";
$sql="SELECT * FROM $table WHERE date=$tomorrow ORDER BY time";
$sql="SELECT * FROM $table WHERE date=$yesterday ORDER BY time";
Please help me with this problem.......................
I am trying to achieve something with date, i hope at least this time i get some help
I am using three categories, contents in today date, yesterday date and tomorrow date.
I am saving date to variable to display in the web page.... pls check the following code
// To display today date
$today = mktime(0, 0, 0, date("m"), date("d"), date("y"));
echo( date("F d, Y", $today));
// To display tomorrow date
$tomorrow = mktime(0, 0, 0, date("m"), date("d")+1, date("y"));
echo ( date("F d, Y", $tomorrow));
// To display yesterday date
$yesterday = mktime(0, 0, 0, date("m"), date("d")-1, date("y"));
echo ( date("F d, Y", $yesterday));
Are above codes correct to save date in a variable? according to above codes date can be displayed, but i need to display content of the table Where date=today and date=tomorrow and date=yesterday respectively, so i tried the following but in vein.... Please help me with this regards and i also need to skip Sunday in between........
The following code used to display the content for table...... is it rite?
$sql="SELECT * FROM $table WHERE date=$today ORDER BY time";
$sql="SELECT * FROM $table WHERE date=$tomorrow ORDER BY time";
$sql="SELECT * FROM $table WHERE date=$yesterday ORDER BY time";
Please help me with this problem.......................