如何在psql中转换unix_timestamp整数?

时间:2019-02-12 09:39:15

标签: sql postgresql unix-timestamp postgresql-8.0

如何将unix_timestamp整数转换为可读文本中的时间。
如:

<a href="#" class="jobAlertToggle">
    <div id="jobalarm_mobile">
        <i class="fa fa-bell"></i>
        <span>Jobalarm aktivieren</span>
        <label class="switch">
            <input type="checkbox">
            <span class="slider round"></span>
        </label>
    </div>
</a>

#jobalarm_mobile {
    display: table;
    font-size: 18px;
    width: 100%;
    height: 40px;
    background: #ff8400;
    color: white;
    font-weight: 400;
    text-align: center;
    position: -webkit-sticky;
    position: sticky;
    bottom: -50px;
    align-self: flex-end;
}
timestamp|integer|not null default 0

1541001600应该转换为select timestamp from table limit 1; 1541001600

PostgreSQL 8.0.2

1 个答案:

答案 0 :(得分:0)

您应该真正升级Postgres!但是我认为这会起作用:

select '1970-01-01'::timestamp + 1541001600 * interval '1 second'