如何在SQL或PHP中将十进制(16,4)转换为DATE或DATETIME [英] How to convert decimal(16,4) to DATE or DATETIME in SQL or PHP

查看:142
本文介绍了如何在SQL或PHP中将十进制(16,4)转换为DATE或DATETIME的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个小问题我的数据库的一个领域...提交时间是十进制(16,4)类型,我需要将其转换为DATE或DATETIME ...但我不会得到它...



一个例子:

  decimal(16,4)datetime 
1334041225.5900 2012-04-10 09:00:25 +02:00


解决方案

> 打印日期('r',1334041225.5900);

(这个编号系统有可能在2012-04-10 09:00与Unix时间戳相交:25 +02:00)。



请参阅 date function 详细信息。



很有可能在SQL中进行转换,但您没有说出这是什么类型的DBMS。


I have a small problem with a field of my db... the submit time is in decimal(16,4) type and I need to convert it to DATE or DATETIME... but I dont get it...

One example:

decimal (16,4)         datetime
1334041225.5900        2012-04-10 09:00:25 +02:00

解决方案

This appears to be a unix timstamp with fractions of seconds, in which case....

print date('r', 1334041225.5900);

(it is possible that this numbering system intersects with Unix timestamps at 2012-04-10 09:00:25 +02:00).

See the manual page for the date function for details of specifics.

It's prob ably possible to do the conversion in SQL but you didn't say what type of DBMS this is.

这篇关于如何在SQL或PHP中将十进制(16,4)转换为DATE或DATETIME的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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