【问题标题】:Covert Convert BigInt timestamp to a real Date将 BigInt 时间戳转换为真实日期
【发布时间】:2014-03-09 01:20:43
【问题描述】:

我有一个旧数据库,但是我不记得我使用的脚本,但如果有人可以提供帮助,我需要转换一个日期

(287,1090231200,1090233000,'日记',0,0,0,1,0)

这是布局

`id` int(11) NOT NULL auto_increment,
  `start_time` bigint(20) default NULL,
  `end_time` bigint(20) default NULL,
  `description` blob,
  `is_note` tinyint(4) default '0',
  `private` tinyint(4) default '0',
  `rec_app_id` int(11) NOT NULL default '0',
  `status` tinyint(4) default '0',
  `all_day` tinyint(4) default '0',
  PRIMARY KEY  (`id`),
  UNIQUE KEY `ID_2` (`id`),
  KEY `ID` (`id`)
) ENGINE=MyISAM AUTO_INCREMENT=15212 DEFAULT CHARSET=latin1 PACK_KEYS=1;

【问题讨论】:

    标签: mysql sql


    【解决方案1】:

    试试这个(例如,如果您的结果以毫秒为单位 - 除以 1000 得到以秒为单位的结果):

    SELECT FROM_UNIXTIME(600000000/1000);
    

    有关详细信息,请参阅syntax

    注意:如果您使用 UNIX_TIMESTAMP()FROM_UNIXTIME()TIMESTAMP 值和 Unix 时间戳值之间进行转换,则转换是有损的,因为映射在两个方向上不是一对一的。

    编辑:另请阅读 thisthis 问题。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2011-04-08
      • 2013-11-04
      • 1970-01-01
      • 1970-01-01
      • 2016-10-08
      • 2016-11-26
      • 2019-10-03
      • 1970-01-01
      相关资源
      最近更新 更多