简体   繁体   English

Oracle上正确的DateTime格式

[英]Proper DateTime Format on Oracle

I have problem with read a datetime format like this : 7/1/2014 6:02:09 AM , my goal is I want to compare some date in query oracle by to_date function but it seems different with the format, like there are no zero in the month, day, and hours. 我在读取这样的日期时间格式时7/1/2014 6:02:09 AM问题: 7/1/2014 6:02:09 AM ,我的目标是我想通过to_date函数比较查询oracle中的某些日期,但该格式似乎有所不同,例如没有月,日和小时为零。

my thought for the better query is like this to_date('7/1/2014 6:02:09 AM','MM/DD/YYYY HH:MI:SS AM') 我想更好的查询的想法是这样to_date('7/1/2014 6:02:09 AM','MM/DD/YYYY HH:MI:SS AM')

but seems like I have wrong format for this. 但似乎我对此格式有误。

Thanks in advance 提前致谢

尝试使用以下格式:

to_date('07-01-2014 12:15','MM-DD-YYYY HH:MI'))

Finally I found the format, I have to change first the AM PM format to 24 hours timestamp : 最后,我找到了格式,我必须先将AM PM格式更改为24小时时间戳:

TO_CHAR(TO_DATE('01/01/1970 00:00:00', 'MM/DD/YYYY HH24:MI:SS')

thank you all audiences :) 谢谢所有观众:)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM