RE: Date Disparity

From: Blanchard, William <wblanchard_at_societyinsurance.com>
Date: Tue, 16 Feb 2010 16:01:07 -0600
Message-ID: <CB340D772D072D47A5DE07533432A7E50E8029B4_at_exch1.soc.int>



I stand corrected. The first day of the month was a Monday so it will return the Monday of this week. It looks like 'd' will return the day of the week (2nd day = Monday).  
W                 Same day of the week as the first day of the month.
TRUNC(SYSDATE,'W')   http://www.java2s.com/Code/Oracle/Date-Timezone/formatsusedwiththeTRUNCf unctionfortheDATEdatatype.htm    

WGB     From: oracle-l-bounce_at_freelists.org
[mailto:oracle-l-bounce_at_freelists.org] On Behalf Of Jared Still Sent: Tuesday, February 16, 2010 3:48 PM To: Oracle-L Freelists
Subject: Date Disparity    

Anyone else see a problem with this:  

  1 select trunc(sysdate,'W'), to_char(trunc(sysdate,'W'),'d')

  2* from dual

13:46:46 ordevdb01.radisys.com - js001292_at_dv11 SQL> /  

TRUNC(SYSDATE,'W') T

  • -

02/15/2010 00:00:00 2  

1 row selected.  

ie. the first day of the week as per trunc() is the second day of the work as per to_char()  

Jared Still
Certifiable Oracle DBA and Part Time Perl Evangelist Oracle Blog: http://jkstill.blogspot.com Home Page: http://jaredstill.com

-

This email and any information, files, or materials transmitted with it are confidential and are solely for the use of the intended recipient. If you have received this email in error, please delete it and notify the sender.

--
http://www.freelists.org/webpage/oracle-l
Received on Tue Feb 16 2010 - 16:01:07 CST

Original text of this message