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

How to define the "end-of-the-month" value 1

Status
Not open for further replies.

UHsoccer

Programmer
Apr 24, 2003
139
US
I use two parameters, the month (Jan, feb, etc) and a second parameter called "number-of-months", then I need to genrate the end date
Thus entering Jan and 1 is Jan-31, Jan and 2 is Feb-28, Jan and 3 is March-31, etc for all month.
I can build an ugly looking long formula, but prefer a short elegant one
 
Try:

dateadd("M",{?MonthNumParm}+1,cdate({?monthparm}+"1, 2003"))-1

-k
 
Sorry, screwed up the spacing:

dateadd("M",{?MonthNumParm},cdate(({?monthparm})+" 1, 2003"))-1

-k

 
That works and it is more than elegant.
Is there a description of what the functions and options are?
 
I'm not sure what you mean?

The help file references all of the functions I used, the dateadd is pretty universal, it being in most SQL and programming languages.

dateadd is
(
what interval period to use for adding,
the quantity to add (plus or minus),
the date to start with
)

-k
 
Thought about it and I hadn't allowed for year changes:

dateadd("M",{?MonthNumParm},cdate(({?monthparm})+" 1, " +totext(year(currentdate),0,""))-1

-k
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top