php - How to set a variable based on time/date -


how can set variable, $a, specific value based on day of week , time of day.

for example, in pseudocode:

mon 09.00h - 16.59h, $a = 5, sat 12.00h - 13.00h, $a = 10 

$time = time()%86400; $date = date("d"); // since 9 hours = 32400 seconds , 16 hours , 59 minutes = 61140 seconds if($date == "mon" && $time >= 32400 && $time <= 61140){ $a = 5; } // since 12 hours = 43200 seconds , 13 hours = 46800 seconds else if($date == "sat" && $time >= 43200 && $time <= 46800){ $a = 10; } 

Comments

Popular posts from this blog

python - Subclassed QStyledItemDelegate ignores Stylesheet -

java - HttpClient 3.1 Connection pooling vs HttpClient 4.3.2 -

SQL: Divide the sum of values in one table with the count of rows in another -