
- Forum
- Programming Talk
- PHP
- Date and time script in PHP
Date and time script in PHP
This is a discussion on Date and time script in PHP within the PHP forums, part of the Programming Talk category; Could some one give me some idea on how to implement date and time display and also greet the users ...
-
Date and time script in PHP
Could some one give me some idea on how to implement date and time display and also greet the users according to time using php ?
THanks
Last edited by admin; 11-06-2006 at 11:47 AM.
-
11-06-2006, 10:48 PM #2
- Join Date
- Jan 2006
- Answers
- 12
display a message for the different times of the day
<?php
$hours = date("G"); //24 hour time without leading zeros. eg. 0 or 23
if($hours >= 22 && $hours <= 3){
echo "My your up late arn\'t you!";
}elseif($hours >= 4 && $hours <= 7){
echo "My your up rather early!";
}elseif($hours >= 8 && $hours <= 12){
echo "Good morning, and how are we today?";
}elseif($hours >= 13 && $hours <= 17){
echo "Good afternoon, are we having a nice day?";
}elseif($hours >= 18 && $hours <= 21){
echo "Good evening, hope you had a nice day.";
}
?>
-
Christopher it was a great program. I had a try on the program and could understand the concept as well as get the output. Thanks for such replies.
-
Sponsored Ads

Reply With Quote





