date() function

Ask about general coding issues or problems here.

Moderators: egami, macek, gesf

Post Reply
User avatar
xlordt
New php-forum User
New php-forum User
Posts: 34
Joined: Thu Dec 12, 2002 9:00 pm
Location: NJ
Contact:

Mon Jan 20, 2003 4:21 am

im tring to create this script that.. if today is the 20 then echo this.. but if its not the 20 then echo else... but i cant get it ..

Code: Select all

<?php

$today = date("l, j, y");
$start = date("monday, 20, 03");
echo $today;

if($today == $start){
 echo "<Br>YaY the day has come!";
}else{
   echo "<Br>You have to wait till the 20th to access this code";
}


?>


can anyone tell me how do i go by this.. thanx
Computer/Programm rox.. (php, c/c++ will take over soon muhahah

User avatar
xlordt
New php-forum User
New php-forum User
Posts: 34
Joined: Thu Dec 12, 2002 9:00 pm
Location: NJ
Contact:

Tue Jan 21, 2003 7:45 am

err and how do i do that... any hints..
Computer/Programm rox.. (php, c/c++ will take over soon muhahah

User avatar
xlordt
New php-forum User
New php-forum User
Posts: 34
Joined: Thu Dec 12, 2002 9:00 pm
Location: NJ
Contact:

Tue Jan 21, 2003 9:15 am

ahh i c what your saying.. ok thanx.. i will search the manual .. and i think you have to use.. stcmp() to compare the strings.. but anyways.. i will go and check.. thanx
Computer/Programm rox.. (php, c/c++ will take over soon muhahah

User avatar
WiZARD
Moderator
Moderator
Posts: 1240
Joined: Thu Jun 20, 2002 10:14 pm
Location: Ukraine, Crimea, Simferopol
Contact:

Wed Jan 22, 2003 8:48 am

Hi!
If you want what i'm solve youre problemdo next:

Code: Select all

<?php

$today = date("l, j, y");
$start = date("Monday, 20, 03");
echo $today;

if($today == $start){
 echo "<Br>YaY the day has come!";
}else{
   echo "<Br>You have to wait till the 20th to access this code";
}


?>


or this:

Code: Select all

<?php

$today = date("l, j, y");
$start = ("Monday, 20, 03");
echo $today;

if($today == $start){
 echo "<Br>YaY the day has come!";
}else{
   echo "<Br>You have to wait till the 20th to access this code";
}


?>


P.S. you no need about timestamp cause you compare simple string :!: :wink:
"Sex,Drugs and Rock&Roll " replaced at "Sucks,Bugs and Plug&Play";
Image

Post Reply
  • Information
  • Who is online

    Users browsing this forum: No registered users and 7 guests