dsyk33753 2014-11-13 11:44
浏览 23
已采纳

如何使用php将没有时区的保存为Timestamp的记录转换为正常日期

I have a postgres database table that has a column of data type timestamp without timezone.... All the records in this column are saved as, for example, 2014-05-16 13:53:11 .... When I try to retrieve this information using a function it brings back a blank $variable or return. Is there a way in php I can be able to get this information? Even if it comes back as it is, date and time its ok. I would just like to be able to retrieve the information. Is there a specific php function I am supposed to use in order to retrieve the correct format of the data?

I didnt place the function here as I believe it useless, I am a beginner please help

Your prompt response would be highly appreciated

  • 写回答

2条回答 默认 最新

  • dpka7974 2014-11-13 12:33
    关注

    Postgres stores a timestamp as 8-byte integer (per default i.e. a date with time between 4713 BC and 294276 AD, using a microsecond precision) so the output is probably not a timestamp like you expected.

    Have a look at Date Type Formatting and try to convert your output to a string. Maybe thats what you need.

    However, a possible more detailed description of your problem (schema, code, example,...) would be appreciated.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥60 ESP32怎么烧录自启动程序
  • ¥50 html2canvas超出滚动条不显示
  • ¥15 java业务性能问题求解(sql,业务设计相关)
  • ¥15 52810 尾椎c三个a 写蓝牙地址
  • ¥15 elmos524.33 eeprom的读写问题
  • ¥15 使用Java milo连接Kepserver服务端报错?
  • ¥15 用ADS设计一款的射频功率放大器
  • ¥15 怎么求交点连线的理论解?
  • ¥20 软件开发方法学习来了
  • ¥15 微信小程序商城如何实现多商户收款 平台分润抽成