oracle date and coldfusion date

anno (烦人)
本文发表在 rolia.net/zh 相约加拿大网上社区枫下论坛
This is a pretty funny story:
I'm using ColdFusion and Oracle as db server.
in my application.cfm I set db date format as this.

ALTER SESSION SET NLS_DATE_FORMAT = 'MM-DD-YYYY HH24:MI:SS'


then when I insert '03/18/02' into a table column(date type),
oracle take it as 03/18/0002, this is fine still although it's already becoming funny.
The joke is here:
when you get this date out and use couldfuion
dateformat(date_value, "MM/DD/YYYY") to show on the page,
It's 03/18/2002 now.

That means, acturally in oracle, you have 03/18/0002, but you can see only 03/18/2002 on the page.

even more than this, when I use sql plus or other tools, most of the tools will show only
03/18/02 or change this date to 03/18/2002.

It gave me a realy hard time to find out what happend in the system.
Cause before you realize this is the problem, you can't find out how come what you can see
03/18/2002 and another 03/18/2002 is not the same day.....


Don't know who had this before, maybe there's some solutions already.

Peter.
更多精彩文章及讨论,请光临枫下论坛. 网址: rolia.net/zh
(#377082@0)
2002-2-22 -05:00

回到话题: oracle date and coldfusion date

回到论坛: HOME枫下论坛枫下论坛主坛工作学习IT技术讨论

URL:   
http://www.rolia.net/zh/post.php?f=0&p=377082