-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathbid_status.php
More file actions
34 lines (24 loc) · 838 Bytes
/
bid_status.php
File metadata and controls
34 lines (24 loc) · 838 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
<?php
function bidStatus($bid_item)
// can only be shown on 1 page at a time
{
$start_date = $bid_item['sta_date'];
$start_time = $bid_item['start_time'];
$start_datetime = strtotime("$start_date" . " " . "$start_time");
$end_date = $bid_item['end_date'];
$end_time = $bid_item['end_time'];
$end_datetime = strtotime("$end_date" . " " . "$end_time");
$now = time();
$diffToEnd = $end_datetime - $now;
$diffFromStart = $now - $start_datetime;
$status = "";
if ($diffToEnd > 0 && $diffFromStart > 0) {
$status = "Ongoing";
} else if ($diffFromStart < 0) {
$status = "Upcoming";
} else if ($diffToEnd < 0) {
$status = "Finished";
}
return $status;
}
?>