[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

DB2 date function for Thurs, Fri, Sat of every week

Posted on 2013-01-22
3
Medium Priority
?
510 Views
Last Modified: 2013-01-31
I'm creating a dynamic report. I need a date function for items that may expire on Thurs or Fri or Sat of every week that the report is run.
How do would I write such a date function?

Thank you.
0
Comment
Question by:saved4use
3 Comments
 
LVL 37

Expert Comment

by:momi_sabag
ID: 38808107
what exactly do you want the function to do? it is not clear from your description
0
 

Author Comment

by:saved4use
ID: 38808150
Reflect items that expire on Thurs, or Fri or Sat of every week. *I need a DB2 date function, for example, 'CURRENT _DATE + 3 days'
0
 
LVL 46

Accepted Solution

by:
Kent Olsen earned 1000 total points
ID: 38808313
Hi Saved,

That's somewhat ambiguous, but with just a bit more information the query is easy to write.

SELECT *
FROM {mytable}
WHERE dayofweek (expiration_date > 4)               -- select only thurday, friday, saturday
  AND current_date + 6 days <= expiration_date   -- and within the next 7 days
  AND expiration_date >= current_date                  -- and in the future (or today)

That's a pretty good start.  It's easy to adjust as you need it.


Good Luck,
Kent
0

Featured Post

Veeam Disaster Recovery in Microsoft Azure

Veeam PN for Microsoft Azure is a FREE solution designed to simplify and automate the setup of a DR site in Microsoft Azure using lightweight software-defined networking. It reduces the complexity of VPN deployments and is designed for businesses of ALL sizes.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

November 2009 Recently, a question came up in the DB2 forum regarding the date format in DB2 UDB for AS/400.  Apparently in UDB LUW (Linux/Unix/Windows), the date format is a system-wide setting, and is not controlled at the session level.  I'm n…
Recursive SQL in UDB/LUW (it really isn't that hard to do) Recursive SQL is most often used to convert columns to rows or rows to columns.  A previous article described the process of converting rows to columns.  This article will build off of th…
Despite its rising prevalence in the business world, "the cloud" is still misunderstood. Some companies still believe common misconceptions about lack of security in cloud solutions and many misuses of cloud storage options still occur every day. …
When cloud platforms entered the scene, users and companies jumped on board to take advantage of the many benefits, like the ability to work and connect with company information from various locations. What many didn't foresee was the increased risk…
Suggested Courses

830 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question