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 wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to find 1st Sunday in a month? 1

Status
Not open for further replies.

jpdmdc

Programmer
Mar 10, 2005
115
Hi,

I'm using Crystal reports 10 with Oracle 9i.

could anyone help me how I can capture 1st sunday's date( in a month) in a variable?

Thank you.
 
There may be a way to do this with less code, but this should work:

local datevar input := {table.date};
local datevar first_day := input - day(input) + 1;
if dayofweek(first_day) > 1
then first_day + (8 - dayofweek(first_day))
else first_day

~Brian
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top