MySQL中时间戳值的内部表示是什么 [英] What is the internal representation of timestamp values in MySQL

查看:146
本文介绍了MySQL中时间戳值的内部表示是什么的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个 .dat 文件,该文件表示数据库中的表,并且具有用于timestamp值的特定列.现在,这些值以以下方式存储:-

I have a .dat file that represents a Table in a database and has a particular column for timestamp values. Now the values are stored in the following way: -

978302039

我需要将所有元素复制到另一个表中,但是我不确定包含这些值的列应该是int还是timestamp.据我所知,我们以以下格式存储timestamp值:-

I'm required to copy all the elements into another table, but I'm not sure if the column containing these values should be of int or timestamp. As far as I know, we store timestamp values in the following format: -

1000:09:12 00:00:00

但是存储在这里的这些值看起来并不像那样. timestamp值是否有内部表示形式?

But these values stored here don't look anything like that. Is there any internal representation of timestamp values?

推荐答案

978302039看起来像是一个以秒为单位的unix时间戳.您可以使用

978302039 looks like a unix timestamp in seconds. You can convert it to MySQLs DATETIME with the FROM_UNIXTIME() function.

SELECT FROM_UNIXTIME(978302039)

将返回类似

2000-12-31 22:33:59

确切值取决于服务器的时区配置.

The exact value depends on the timezone configuration of your server.

这篇关于MySQL中时间戳值的内部表示是什么的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆