-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdt_dashboard.php
More file actions
40 lines (32 loc) · 846 Bytes
/
dt_dashboard.php
File metadata and controls
40 lines (32 loc) · 846 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
<?php
$shows = [
1 => [
0 => 'Morning show',
8 => 'The Breakfast Show',
10 => 'The Fred and Lucy Hour'
],
/*** each day shows array ***/
5 => [
0=>'Sunday good show',
15 => 'The Hymn Hour'
]
];
$weekday = date('N');
$hour = date('H');
$now_plaing = 'Default show';
$tz = 'CST';
$timestamp = time();
$dt = new DateTime("now", new DateTimeZone($tz)); //first argument "must" be a string
$dt->setTimestamp($timestamp); //adjust the object to correct timestamp
printf("day: %s\n",$dt->format('w'));
printf("hour: %s\n",$dt->format('H'));
$hour=$dt->format('H');
$weekday=$dt->format('w');
printf("day: %s\n",$weekday);
printf("hour: %s\n",$hour);
foreach($shows[$weekday] as $h=>$show) {
if ($h <= $hour) $now_plaing = $show;
}
printf("day:%s\n", $weekday);
printf("hour:%s\n", $hour);
printf("Now Playing: %s", $now_plaing);