Jump to content

[SOLVED] Time before/after noon


soycharliente

Recommended Posts

I'm trying to write a basic check to see if it's after noon on a given day and to redirect the page accordingly. I'm getting a parse error and I don't know why.

 

If someone knows of a better way to do this as well, I'm open to learning.

 

Thanks.

 

Code:

<?php
if date("U") > date("U", mktime(12,0,0,date("F"),date("d"),date("Y"))) {
header("Location: /afternoonschedule");
} else {
header("Location: /morningschedule");
}
?>

 

Error:

Parse error: syntax error, unexpected T_STRING, expecting '(' in /schedule.php on line 3
Link to comment
https://forums.phpfreaks.com/topic/134271-solved-time-beforeafter-noon/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.