wesleypipes Posted November 5, 2006 Share Posted November 5, 2006 Hi, id just like to know how id go about adding a page to my site. Basically, id like the page to display the date and time generated using php and also greet them. The greeting will change depending on time of day e.g good evening , morningthanks Link to comment https://forums.phpfreaks.com/topic/26193-can-some1-help-me-out-on-somthing-simple-to-do-with-data-and-time/ Share on other sites More sharing options...
JasonLewis Posted November 5, 2006 Share Posted November 5, 2006 this is how you'd display a message for the different times of the day:[code=php:0]<?php$hours = date("G"); //24 hour time without leading zeros. eg. 0 or 23if($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.";}?>[/code] Link to comment https://forums.phpfreaks.com/topic/26193-can-some1-help-me-out-on-somthing-simple-to-do-with-data-and-time/#findComment-119799 Share on other sites More sharing options...
wesleypipes Posted November 5, 2006 Author Share Posted November 5, 2006 cheers project, much apprieciated Link to comment https://forums.phpfreaks.com/topic/26193-can-some1-help-me-out-on-somthing-simple-to-do-with-data-and-time/#findComment-119806 Share on other sites More sharing options...
wesleypipes Posted November 5, 2006 Author Share Posted November 5, 2006 hey doesnt work lol Link to comment https://forums.phpfreaks.com/topic/26193-can-some1-help-me-out-on-somthing-simple-to-do-with-data-and-time/#findComment-119810 Share on other sites More sharing options...
Ben Phelps Posted November 5, 2006 Share Posted November 5, 2006 Works fine on my server. Link to comment https://forums.phpfreaks.com/topic/26193-can-some1-help-me-out-on-somthing-simple-to-do-with-data-and-time/#findComment-119811 Share on other sites More sharing options...
JasonLewis Posted November 6, 2006 Share Posted November 6, 2006 whats wrong with it? is it displaying any errors or anything wesleypipes? Link to comment https://forums.phpfreaks.com/topic/26193-can-some1-help-me-out-on-somthing-simple-to-do-with-data-and-time/#findComment-120177 Share on other sites More sharing options...
wesleypipes Posted November 6, 2006 Author Share Posted November 6, 2006 sorry m8, its fine, my fault Link to comment https://forums.phpfreaks.com/topic/26193-can-some1-help-me-out-on-somthing-simple-to-do-with-data-and-time/#findComment-120225 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.