datetime - Oracle date format problem -


i have following strange problem in oracle

(please keep in mind have little experience in sql , less in oracle).

if this:

select to_char(sysdate, 'yyyy-mm-dd hh24:mi') dual 

i this: 2010-12-02 18:39

all fine there.

however, if this:

update favorite_item set favorite_item.last_used_date = to_date(sysdate, 'yyyy-mm-dd hh24:mi') favorite_item.favorite_item_id = 1 

i in database: 10-dec-02

which 10th of december '02 not correct

if confirm:

select to_char(favorite_item.last_used_date, 'yyyy-mm-dd hh24:mi') last_used_date     favorite_item     favorite_item.favorite_item_id = 1    

i this: 0002-12-10 00:00

which wrong.

what doing wrong? feel date setting not working correctly.

thanks in advance help.

don't use to_date() on sysdate; sysdate date.

update favorite_item   set favorite_item.last_used_date = sysdate   favorite_item.favorite_item_id = 1` 

Comments

Popular posts from this blog

asp.net - repeatedly call AddImageUrl(url) to assemble pdf document -

java - Android recognize cell phone with keyboard or not? -

iphone - How would you achieve a LED Scrolling effect? -