× 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.



D SomeDate                    S                D   Inz(d'0001-01-01')
D InvDate                        S              6 0   Inz(062200)
D Yesterday                    S              6 0    Inz(0)

C      *MDY               Move     InvDate      SomeDate
C                                SubDur  1:*D           SomeDate
C      *MDY               Move     SomeDate  Yesterday

SomeDate now contains the date 2000-06-21.  Yesterday should contain
62100.   This is all untested code and typed in on the fly here.  It is possible
I have a few syntax errors, also, formatting is guaranteed to be off.

Few things of note here.

1.  Use MOVE with *MDY or *YMD or *CYMD to move a numeric or
character field into a date variable.
2. Use SubDur and AddDur to subtract or add durations to dates.  If you
use AddDur and add a negative number, it is subtracting duration, so you
could only use adddur if you wanted.
3. You do not have to initialize a date, it's just a habit I've gotten into.
4. Types of duration code include: *YEARS, *MONTHS, *DAYS, *D
(same as *DAYS), *MS, *MINUTES, *HOURS (for time/date time stamps).
5. It is preferable to use date variables isntead of numeric whenever possible.
In the above I did some conversion to show how it was done, but you should
keep them as date variables instead of converting them back, if you can.

Regards,

Jim Langston

Quazy wrote:

> I am looking for a free utility or program that will give me yesterdays date. 
>  I was wondering if someone out there has written such a thing that they 
>would be willing to share.  I can do this myself but it is a pain to check for 
>leap year and stuff, I just didn't want to re-invent the wheel if it is 
>already out there.   Thanks

+---
| This is the RPG/400 Mailing List!
| To submit a new message, send your mail to RPG400-L@midrange.com.
| To subscribe to this list send email to RPG400-L-SUB@midrange.com.
| To unsubscribe from this list send email to RPG400-L-UNSUB@midrange.com.
| Questions should be directed to the list owner/operator: david@midrange.com
+---

As an Amazon Associate we earn from qualifying purchases.

This thread ...

Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

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.