× 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 Mon, 2005-03-14 at 06:37, Ewart Desouza wrote:
> 
> 
> Hello Joel,
> 
> I am trying out your function DateAsInteger it works well, but I found one
> problem.
> 
> I the H specs the date is in *YMD format.
> 
> dateasinteger() i.e. with no parameters displays 20050314 which is fine.
> 
> What I want is a 6 digit numeric value like 050314, How should I go about
> it  ???

Here is a link to the documentation for this procedure:
http://www.rpgnext.com/docs/rnbdates/xRPG_procedures_dateAsInteger.php

To get a six-digit return, specify the second parameter as '6':
 /free
     myDateInt = dateAsInteger( %date() : 6 );
 /end-free

> Another thing, do you have the reverse function by any chance i.e
> converting a numeric field of 6/8 digits into a date field ???
> 
> I am in the process of developing a production system where the date is
> used very often. The users have suggested me to have numeric dates
> displayed on screen so that it becomes easy for data entry.  Entering
> 050314 is easier than 2005-03-14. So I plan to convert the date to a 6
> digit numeric field when displaying it on screen & then converting it back
> to the date form when writing it on disk.

I don't really have one going the other way, because the %date() BIF is
so flexible.  Read this article for more on Data Handling in RPGIV:
http://www.itjungle.com/fhg/fhg051904-story01.html

Especially look at the section entitled "MAKING DATES FROM NUMERIC
VARIABLES".

If you really don't want to use the %date() BIF, check out the
createDate() sub-procedure in RPGNext:
http://www.rpgnext.com/docs/rnbdates/xRPG_procedures_createDate.php

It requires a ten-character string, so you'll have to convert the
numeric value to character first.

HTH,

Joel


> 
> Thanks & best regards
> Ewart
> 
> _______________________________________________
> This is the RPGNext Discussion and Information (RPGNext) mailing list
> To post a message email: RPGNext@xxxxxxxxxxxx
> To subscribe, unsubscribe, or change list options,
> visit: http://lists.midrange.com/mailman/listinfo/rpgnext
> or email: RPGNext-request@xxxxxxxxxxxx
> Before posting, please take a moment to review the archives
> at http://archive.midrange.com/rpgnext.


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