Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Dates Issue

Status
Not open for further replies.

IronChump

IS-IT--Management
Aug 12, 2005
6
0
0
AU
In our system dates are stores as mnth year eg. mnth='06' year='2005'

My problem is that I need to report back 6 months ago, which is easy enough to do except when the year changes.

what I am curretly doing is
select * from Test where mnth=to_char(sysdate,'MM')-6 and year=to_char(sysdate,'YYYY')

but when the the sysdate is 01 2006 i can use the same query..

If anyone can help it would be appreciated
 
You may convert your application dates to normal Oracle dates and then process them:
Code:
...
where to_date(mnth||year,'mmyyyy')= trunc(add_months(sysdate,-6),'MM')
..

Regards, Dima
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top