我在Postgresql中有“ 17/12/2011”格式的日期。
如何使用postgreql的select子句将其转换为毫秒?
目前我只是在执行select子句
select tableDate,tableSales
from table_name
我希望有类似的东西,当我选择tableDate时,应该使用一些postgresql函数将其转换为毫秒。
tableDate DATE
tableSales Numeric
extract(epoch from ...)
将返回秒数,1970-01-01 00:00:00
因此您所需要做的就是将其乘以1000:
select extract(epoch from tableDate) * 1000, tableSales
from table_name
手册中的更多详细信息:
http://www.postgresql.org/docs/current/static/functions-datetime.html#FUNCTIONS-DATETIME-EXTRACT
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句