Focal Point
[SOLVED] Converting a MDYY field to a Year - Month (2019-Jul)

This topic can be found at:
https://forums.informationbuilders.com/eve/forums/a/tpc/f/7971057331/m/1147043296

January 14, 2020, 08:04 AM
sherrihe
[SOLVED] Converting a MDYY field to a Year - Month (2019-Jul)
I have a date field that returns in a by statement as 07/01/2019 I need to convert it to say 2019-July. The database field is defined as a MDYY.

This message has been edited. Last edited by: FP Mod Chuck,


8201
January 14, 2020, 10:11 AM
BabakNYC
YOURDATEFIELD/YYMtr=OLDDATEFIELD;


WebFOCUS 8206, Unix, Windows
January 14, 2020, 01:36 PM
Waz
This is well documented, and has been asked many times in the past, with many solutions.


Waz...

Prod:WebFOCUS 7.6.10/8.1.04Upgrade:WebFOCUS 8.2.07OS:LinuxOutputs:HTML, PDF, Excel, PPT
In Focus since 1984
Pity the lost knowledge of an old programmer!

January 15, 2020, 07:55 AM
sherrihe
quote:
YOURDATEFIELD/YYMtr=OLDDATEFIELD;

That does not work. I am trying to convert it to alpha. I have to join two tables one is MTR format and the other is YYMDy format. I have search the focal point and the online dictionary with no results


8201
January 15, 2020, 10:12 AM
DWaybright
sherrihe,
If you make both date fields the same format it should work. If it still doesn't, the problem may not be with the field formats but with the file formats. Are both files you are joining the same format (FOC, SQL, etc)?


WebFOCUS 8.2.03 (production), 8.2.06 (testing)
AppStudio, InfoAssist
Windows, All Outputs
January 15, 2020, 09:17 PM
StuBouyer
If you need it in alpha then FPRINT is your friend

DEFINE FILE TRADES
DATE_ONE/YYMtr=DATE_OF_TRADE;
DATE_TWO/A25V=FPRINT(DATE_ONE, 'YYMtr', DATE_TWO);
DATE_THREE/A25V=REPLACE(DATE_TWO, ', ', '-');
END

Not sure if REPLACE is available in 8201, if not then you can use STRREP

Cheers

Stu


WebFOCUS 8.2.03 (8.2.06 in testing)