DATE formatting

This Q&A forum allows users to post and respond to "How Do I Do ....." questions. Please do not use to report (suspected) errors - you must use your regional help desk for this. The information contained in this forum has not been validated by LANSA and, as such, LANSA cannot guarantee the accuracy of the information.
Post Reply
kno_dk
Posts: 55
Joined: Tue Feb 23, 2016 12:00 am

DATE formatting

Post by kno_dk » Mon Oct 09, 2017 8:49 pm

Hi.

I have an old WEBEVENT (RDMLX) function where we have a date in a list. Today the format is yyyy.mm.dd. Now the customer want it to be dd.mm.yy and they want to keep the leding zero eg 09-10-17. I have created a virtual field tha make the conversion of the data and The field have the Y edit code. It removes the leding zero.
Can I do it with the some kind of formatting the <RDML MERGE="KWORDDV6" FORMAT=4>, edit word(would that work in web) or do anybody have a better solution (some RDMLX code that move the date into a string)?

/Klaus

User avatar
HMJust
Posts: 49
Joined: Wed May 11, 2016 7:23 pm
Contact:

Re: DATE formatting

Post by HMJust » Wed Oct 11, 2017 11:02 pm

If you are just looking for data to string, this has worked for me:

Code: Select all

Define Field(#HMJDATE) Type(*DATE)
#HMJDATE := *YYMMDD
#WCHAR8 := #HMJDATE.AsString.Substring( 9 2 ) + '-' + #HMJDATE.AsString.Substring( 6 2 ) + '-' + #HMJDATE.AsString.Substring( 3 2 )
I don't know what I am doing, nor how I did it. If it works, luck was involved :geek:

Post Reply