×
The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.
On 06/07/2008, at 7:33 AM, Booth Martin wrote:
Simplest way to set a date as the first of the current month.
This *has* to be simpler than I am making it.
I want the first and last day of last month. No biggy.
Its the first of this month,
less a day, and less a month. Easy.
But then I had a brain flat. How do I easily make %date() = the first
of the current month?
Don't. Just use a data structure to re-map the date fields and force
a 1 into the day component.
If you find that too obscure then perhaps:
d firstOfMonth S D
d lastOfMonth S D
d x S 5I 0
/FREE
firstOfMonth = %date() - %days( %subdt( %date() : *D )-1 );
lastOfMonth = firstOfMonth + %months(1) - %days(1);
/END-FREE
This provides first and last of current month. Change %DATE to a date
variable and it will work for any month. Make each function a
separate procedure and stick it in your date service program.
Regards,
Simon Coulter.
--------------------------------------------------------------------
FlyByNight Software OS/400, i5/OS Technical Specialists
http://www.flybynight.com.au/
Phone: +61 2 6657 8251 Mobile: +61 0411 091 400 /"\
Fax: +61 2 6657 8251 \ /
X
ASCII Ribbon campaign against HTML E-Mail / \
--------------------------------------------------------------------
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact
[javascript protected email address].
Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.