如何将此特定时间转换为此处的时间?

How do I convert this specific time into the one here?

body body body body body body body body body body body body body body

Date('Y-m-d h:i:s', strtotime($datestring));

我喜欢使用 PHP 的 DateTime class,这里有一个例子。

$newdate = new DateTime($yourdate);
$date = $newdate->format('Y-m-d H:i:s');

$mysqli = new mysqli("localhost", "my_user", "my_password", "world");
$stmt = $mysqli->prepare("UPDATE table SET column = ? WHERE row = ?")
$stmt->bind_param("ss", $date, $row);
$stmt->execute();

编辑:
因此,您没有从抓取的网站获得格式正确的日期,它是 HTML。我建议用 JQuery.

来处理这个问题

这是你得到的:

<th colspan="3" class="comp-date"> Saturday, February 7, 2015</th><td class="status"> 17:30</td>

我们可以通过 class 名称获取所需的信息,下面的代码将需要进入 PHP 文件。

<?php
    $scrapedDate = ....;
?>
<html>
<head>
//add JQuery to the <head> section//
<script src="//code.jquery.com/jquery-1.11.2.min.js"></script>

<script>
$(function() {
    $scraped = '<?= $scrapedDate ?>'; //get data from PHP//
    $scrapedDate = $($scraped).closest('.comp-date').text().trim();
    $scrapedTime = $($scraped).closest('.status').text();
    $dateTime = $scrapedDate+$scrapedTime;

    alert($dateTime);
    return false;
});
</script>
</head>

我测试了这个并且它有效,但是,在这样做之后你需要把它放回 PHP,你可以使用 AJAX 来做。

您如何构建 $dateTime 字符串?你能 post 编码吗?看起来你的答案已经完成一半了

类似于: $dateTime = $day.",".$month.",".$year;