Oracle Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsDatabasesOracle Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
  #1  
Old July 28th, 2004, 02:23 PM
StevenC's Avatar
StevenC StevenC is offline
PHP & Java Error Master
Dev Shed Beginner (1000 - 1499 posts)
 
Join Date: Jun 2003
Location: My Computer
Posts: 1,217 StevenC User rank is Sergeant (500 - 2000 Reputation Level)StevenC User rank is Sergeant (500 - 2000 Reputation Level)StevenC User rank is Sergeant (500 - 2000 Reputation Level)StevenC User rank is Sergeant (500 - 2000 Reputation Level)StevenC User rank is Sergeant (500 - 2000 Reputation Level) 
Time spent in forums: 1 Day 1 h 15 m 14 sec
Reputation Power: 14
Select date range now -> end the month

Anyone know how I would check to see if a date was between now and the end of the month?
__________________


Webinfractions.com
Think I'm wrong? You're probably right!

Reply With Quote
  #2  
Old July 28th, 2004, 04:23 PM
KK2796 KK2796 is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jul 2004
Posts: 11 KK2796 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 50 m 40 sec
Reputation Power: 0
Quote:
Originally Posted by StevenC
Anyone know how I would check to see if a date was between now and the end of the month?


Code:
SELECT  CASE WHEN (SYSDATE <= :D1) 
              AND (TO_CHAR(:D1,'MMYYYY') = TO_CHAR(SYSDATE,'MMYYYY')) 
             THEN 'Y' ELSE 'N' 
        END SAME_MONTH
FROM DUAL;

Reply With Quote
  #3  
Old July 28th, 2004, 11:07 PM
gamyers gamyers is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jul 2004
Posts: 14 gamyers User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
:test_date between sysdate and last_day(sysdate)
works for 'whole' days
last_day returns the last day in the current month, but with the current time, so it it will give an incorrect result if you run it for a date/time of say 31-jul-2004 15:30 when the system time is 11:15
If you want to be more accurate you could use

:test_date >= sysdate
and :test_date < last_day(trunc(sysdate))+1

Reply With Quote
  #4  
Old July 29th, 2004, 03:53 PM
StevenC's Avatar
StevenC StevenC is offline
PHP & Java Error Master
Dev Shed Beginner (1000 - 1499 posts)
 
Join Date: Jun 2003
Location: My Computer
Posts: 1,217 StevenC User rank is Sergeant (500 - 2000 Reputation Level)StevenC User rank is Sergeant (500 - 2000 Reputation Level)StevenC User rank is Sergeant (500 - 2000 Reputation Level)StevenC User rank is Sergeant (500 - 2000 Reputation Level)StevenC User rank is Sergeant (500 - 2000 Reputation Level) 
Time spent in forums: 1 Day 1 h 15 m 14 sec
Reputation Power: 14
Thanks, didn't know about last_day.
So after seeing that, I believe what I need is:
Code:
SELECT * FROM mytable
WHERE myCol BETWEEN SYSDATE AND  trunc(last_day(add_months(SYSDATE, 1)))
I'm not too worried about the accuracy of that.

Thanks!

Reply With Quote
Reply

Viewing: Dev Shed ForumsDatabasesOracle Development > Select date range now -> end the month


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump

 Free IT White Papers!
 
Accelerating Trading Partner Performance
One in five. That's how many partner transactions have at least one error. That is an amazing statistic, particularly given the extraordinary leaps in innovation across the global supply chain during the past two decades. Download this white paper to learn more.

 
Competing on Analytics
This Tech Analysis is designed to help identify characteristics shared by analytics competitors, and includes information about 32 organizations that have made a commitment to quantitative, fact-based analysis.

 
Cost Effective Scaling with Virtualization and Coyote Point Systems
An overview of the industry trend toward virtualization, how server consolidation has increased the importance of application uptime and the steps being taken to integrate load balancing technology with virtualized servers.

 
Five Checkpoints to Implementing IP Telephony
Implementation planning for IP PBX software and IP telephony has become vital as businesses replace discontinued legacy PBX phone systems. This informative whitepaper outlines five "checkpoints" for any implementation plan that will help make IP communications a successful proposition.

 
Hosted Email Security: Staying Ahead of New Threats
In the last two years, email has become a fierce battleground between the nefarious forces of spam and malware, and the heroes of messaging protection. The spam volumes increased alarmingly every month, bringing clever new forms of phishing and virus propagation attacks.

 

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 3 hosted by Hostway