如何将用于转换UNIX的代码放到可读时间

时间:2016-01-29 10:08:43

标签: php mysql unix

我需要有关代码的帮助。我在游戏中建立一个适度的家务。在游戏中你可能会被禁止。没有问题,但是当我想在管家中编写禁止过期时间时,刚刚过期时间的mysql结构在DOUBLE(unix时间)中写入。如何在家务管理中将其转换为可以读取时间格式正常?

也许之前会问这个问题,但我需要帮助代码,因为我不是专业编码人员哈哈。我该如何编写代码?

我喜欢这个:

$getBans = mysql_query("SELECT * FROM `bans`");
$page_number    = $_GET['page_number'];
if(!isset($_GET['page_number']) || !is_numeric($_GET['page_number']))
{
    $page_number = 1;
}
$pages      = mysql_num_rows($getBans);
$per_page   = "15";
$last_page  = ceil($pages/$per_page);
if ($page_number < 1)
{
    $page_number = 1;
}
    else if($page_number > $last_page)
{
    $page_number = $last_page;
}
$max    = 'LIMIT ' .($page_number - 1) * $per_page .',' .$per_page;
$data_p = mysql_query("SELECT * FROM `bans` ORDER BY `id` DESC $max ");
$next_page          = $page_number+1;
$previous_page      = $page_number-1;
echo "
<div class='center80'>
    <table class='zebra-striped'>
        <thead>
            <tr>
                <th>Ban ID</th>
                <th>Type</th>
                <th>Value</th>
                <th>Reason</th>
                <th>Banned By</th>
                <th>Expires</th>
                <th>More Information</th>
            </tr>
        </thead>
        <tbody>";
        if(mysql_num_rows($getBans) == 0)
        {
            echo("<tr><td>There are no bans to display</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td></tr>");
        }
            else
        {
            while($ban = mysql_fetch_array($data_p))
            {
                $banid      = $ban['id'];
                $bantype    = $ban['bantype'];
                $banvalue   = $ban['value'];
                $banreason  = $ban['reason'];
                $banexpire  = $ban['expire'];
                $banaddedby = $ban['added_by'];
                $banaddedon = $ban['added_date'];
                $banappeal  = $ban['appeal_state'];
                $banuserid  = $users->user_Data($banvalue,"id");

                echo("<tr><td>".$banid."</td><td>".$bantype."</td><td>".$banvalue."</td><td>".$banreason."</td><td>".$banexpire."</td><td>".$banaddedby."</td><td>");

家务管理的时间现在显示在&#34; Expires&#34;:1532908334.8502。

我应该在代码中写什么来将其转换为正常的日期和时间?

由于

0 个答案:

没有答案