获取已解析日期对象的当前日期格式

时间:2019-04-16 14:16:14

标签: python python-3.x datetime

是否有一种方法可以将给定的字符串格式与日期时间格式进行解析?

类似的东西:

// if I clicks the publish post button

if (isset($_GET['publish']) || isset($_GET['unpublish'])) {
$message = "";
if (isset($_GET['publish'])) {
    $message = "Post published successfully";
    $post_id = $_GET['publish'];
} else if (isset($_GET['unpublish'])) {
    $message = "Post successfully unpublished";
    $post_id = $_GET['unpublish'];
}

togglePublishPost($post_id, $message);

}

function togglePublishPost($post_id, $message)
{
global $conn;
$sql = "UPDATE posts SET published=!published WHERE id=$post_id";

if (mysqli_query($conn, $sql)) {
    $_SESSION['message'] = $message;
    header("location: posts.php");
    exit(0);
}
}

0 个答案:

没有答案