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



Malchow, Grizzly wrote:

I'm trying to convert a date that is *CYMD in a 7 digit Signed field to
*MDY in a 6 digit signed field. I keep getting errors.


Here's my code

rStDate = %Date(hstSDATE:*MDY);

Does rStDate have to have a date data type?

The %DATE built-in function returns a value of type date.


For 7 digit numeric *CYMD to 6 digit numeric *MDY, you need to code something like:

datmdy = %int(%char(%date(datcymd:*CYMD):*MDY0));

That is, first you convert the numeric from format *CYMD to a date value. Then, you convert the date value to character assuming format *MDY0 (no separator). Finally, the character value is converted to numeric and assigned to the target.

(For V5R1, use atoi() instead of %int().)

A future release may see a bit of improvement in this particular type of operation.

Cheers! Hans



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.