How to convert timestamp to oracle Date type
2010-09-02 16:04
661 查看
How to convert timestamp(milliseconds to 1970-1-1) to oracle Date type
* convert timestamp to date
select to_date( '1970-01-01 00:00:00', 'yyyy-mm-dd hh24:mi:ss')+ 3600000
/86400000 as timestamp from dual
timestamp
-----------------------------
1970-01-01 01:00:00.0
* convert date to timestamp
select (to_date('2010-09-01 16:00:00','yyyy-mm-dd hh24:mi:ss')
- to_date('1970-01-01','yyyy-mm-dd'))*86400000 as aDate from dual
aDate
-----------------------------
1283356800000
Note: 86400000 = 24*60*60*1000 (total milliseconds of one day)
* convert timestamp to date
select to_date( '1970-01-01 00:00:00', 'yyyy-mm-dd hh24:mi:ss')+ 3600000
/86400000 as timestamp from dual
timestamp
-----------------------------
1970-01-01 01:00:00.0
* convert date to timestamp
select (to_date('2010-09-01 16:00:00','yyyy-mm-dd hh24:mi:ss')
- to_date('1970-01-01','yyyy-mm-dd'))*86400000 as aDate from dual
aDate
-----------------------------
1283356800000
Note: 86400000 = 24*60*60*1000 (total milliseconds of one day)
相关文章推荐
- Spring 整合 Flex (BlazeDS)无法从as对象 到 Java对象转换的异常:org.springframework.beans.ConversionNotSupportedException: Failed to convert property value of type 'java.util.Date' to required type 'java.sql.Timestamp' for property 'wfsj'; nested exception is java.lang.Ill
- How to convert a date to internal or external format?
- ctypes.ArgumentError: argument 1: <class 'TypeError'>: Don't know how to convert parameter 1
- 【Z一贴】C++ String: How to convert a string into a numeric type?
- How To Add Day, Hour, Minute, Second to a Date Value in Oracle
- How to set user-defined-type as Oracle SP input parameter in .NET
- How to set user-defined-type as Oracle SP input parameter in .NET
- Failed to convert from type java.lang.String to type java.util.Date for value………解决办法
- Failed to convert property value of type [java.lang.String] to required type [java.util.Date] for pr
- How to Convert a Date Time to “X minutes ago” in C# z
- oracle 、sql server、mysql 日期转字符串:convert、to_char、date_forma
- Cannot convert value of type [java.lang.String] to required type [java.util.Date] for property 'xxx': no matching editors or conversion strategy found
- How to convert any valid date string to a DateTime.
- 解决:Failed to convert value of type 'java.lang.String' to required type 'java.util.Date';
- [置顶] 解决:Failed to convert value of type 'java.lang.String' to required type 'java.util.Date';
- Cannot convert value of type [java.lang.String] to required type [java.util.Date] for property 'xxx'
- Failed to convert from type java.lang.String to type java.util.Date for value………解决办法
- How to convert a type object from unshared to shared.
- Failed to convert property value of type [java.lang.String] to required type [java.util.Date] for pr
- How to convert from windows timestamp to unix timestamp