php mysql日期转换小数

php mysql日期转换小数

问题描述:

I have a date. The format is:

1298588277.0

Note the decimal. This is from an xml feed so I cannot directly change the format. I am led to believe the decimal will be used later once "time runs out" as we all know.

What is the best way to store this as a single column value in a mysql database? What should I set the column as?

我有一个约会。 格式为: p>

  1298588277.0 
  code>  pre> 
 
 

注意小数。 这是来自xml feed,所以我无法直接更改格式。 我被引导相信一旦“时间耗尽”,小数将在以后使用,我们都知道。 p>

将此作为单个列值存储在mysql数据库中的最佳方法是什么 ? 我应该将列设置为什么? p> div>

Any reason why you cannot use the DECIMAL column type?

ALTER TABLE `tablename` ADD `fieldname` DECIMAL( 15, 2 ) NOT NULL DEFAULT '0'

EDIT Ahh... read the comments before answering, eh? :embarrassed: