|Oracle Dates, Timestamps and Intervals - An overview of the usage of dates, timestamps and intervals in Oracle databases.|
Timestamp to Date said...Hello Tim,
I was looking for an option to convert timestamp data type to date. As my search lead me to your article may I suggest to add the following to it?
How to transfer timetamp to date format example:
select CAST(systimestamp AS DATE) cSYSDATE from dual;
Thanks for spotting the omission. I've added a two-way conversion into the article.
chaitu said...Hi Tim,
While explaining the TRUNC and ROUND with year format model(YY), you've given the explanation that it rounds to July 1st. But, It rounds to Jan 1st.
May be a typo error. Please check it.
Dave from NJ said...Hi, your example for NEXT_DAY(date, day) indicates that the next Monday after Oct 7, 2004, would be Dec 7, 2004, but I think this is wrong. The next Monday would be Oct 11, 2004. I tested with:
Yes. You're correct. Not sure how that happened. Doesn't even look like a dodgy copy/paste. :(
BTW, I tested it with this.
PS. I corrected the date. Thanks. :)
Dave from NJ said...Update: my comment was because I was reading 10/07/2004 as Oct 7, 2004, and because I was reading 12/07/2004 as Dec 7, 2004. This would match the "normal" US convention of mm/dd/yyyy. However I think your examples were dd/mm/yyyy so they were July 10, 2004, and July 12, 2004. And these dates were correct because July 12 IS the next Monday. Your new date 11/07/2004 is now wrong, sorry!
Tim... said...LOL. I just took your dates and plugged them in to the SQL. I didn't even think to check my original example. :)
I think I should go through and redo the tests, using a format mask of 'DD-MON-YYYY' to save confusion. :)