Time into Variable$todae=date ("Y/m/d-G:i"); According to HourDay<?php if (date("H")<19) {echo "Day";} else {echo "Night";} ?> It is 17<?php $a = (date("H")); switch($a) { case "01": print("It is 01"); break; case "02": print("It is 02"); break; case "03": print("It is 03"); break; case "04": print("It is 04"); break; case "05": print("It is 05"); break; case "06": print("It is 06"); break; case "07": print("It is 07"); break; case "08": print("It is 08"); break; case "09": print("It is 09"); break; case "10": print("It is 10"); break; case "11": print("It is 11"); break; case "12": print("It is 12"); break; case "13": print("It is 13"); break; case "14": print("It is 14"); break; case "15": print("It is 15"); break; case "16": print("It is 16"); break; case "17": print("It is 17"); break; case "18": print("It is 18"); break; case "19": print("It is 19"); break; case "20": print("It is 20"); break; case "21": print("It is 21"); break; case "22": print("It is 22"); break; case "23": print("It is 23"); break; case "24": print("It is 24"); break; default: print("I don't Know What Time It Is"); break; } ?> Convert Timezone<?php $todae=date ("G:i"); $date = new DateTime($todae, new DateTimeZone('America/Chicago')); date_default_timezone_set('America/New_York'); $todae=date("G:i", $date->format('U')); ?> |
DAY %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% d - The day of the month (from 01 to 31) | 04 WEEK %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% W - The ISO-8601 week number of year (weeks starting on Monday) | 40 MONTH %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% F - A full textual representation of a month (January through December) | October YEAR %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% L - Whether it's a leap year (1 if it is a leap year, 0 otherwise) | 1 TIME %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% a - Lowercase am or pm | pm Etc %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% e - The timezone identifier (Examples: UTC, Atlantic/Azores) | UTC |